Full_Name: Nadezhda Ivanova
OS: Ubuntu 18.04
Submission from: (NULL) (22.214.171.124)
The attached patches provide a fix for a problem, reported by a customer:
Occasionally, when the remote target of an asyncmeta database is restarted,
slapd crashes with assertion error in connection_init:
assert( c->c_struct_state == SLAP_C_UNUSED );
The issue occurs very rarely, but I managed to reproduce it.
It was caused by the fact that on socket error, try_read1msg would close the
LDAP connection (ld) to that target, making the fd available to be used again
for another connection. Asyncmeta is not aware of that, so it doesn't stop the
listener on the corresponding Connection. If a new LDAP connection is opened to
a different, active target using the same fd, asyncmeta would call
connection_init on an already used Connection, which causes the assertion
The fix consists of three separate patches:
This moves initizalization of c_mutex to connections_init, and therefore any
further access to a Connection can be synchronized, eliminating some race
This adds the LDAP_OPT_KEEPCONN option, which instructs try_read1msg that the
connection will be freed by the client.
This updates asyncmeta to make use of LDAP_OPT_KEEPCONN.
The attached files are derived from OpenLDAP Software. All of the modifications
to OpenLDAP Software represented in the following patch were developed by Symas
Corporation. Symas Corporation has not assigned rights and/or interest in this
work to any party. I, Nadezhda Ivanova, am authorized by Symas Corporation, my
employer, to release this work under the following terms.
The attached modifications to OpenLDAP Software are subject to the following
Copyright 2019 Symas Corporation
Redistribution and use in source and binary forms, with or without
are permitted only as authorized by the OpenLDAP Public License.