Full_Name: Nadezhda Ivanova Version: 2.5 OS: Ubuntu 18.04 URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (93.152.142.241)
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 failure.
The fix consists of three separate patches:
ftp://ftp.openldap.org/incoming/nadezhda-ivanova-190228_2.patch
This moves initizalization of c_mutex to connections_init, and therefore any further access to a Connection can be synchronized, eliminating some race conditions.
ftp://ftp.openldap.org/incoming/nadezhda-ivanova-190228_3.patch
This adds the LDAP_OPT_KEEPCONN option, which instructs try_read1msg that the connection will be freed by the client.
ftp://ftp.openldap.org/incoming/nadezhda-ivanova-190228_4.patch
This updates asyncmeta to make use of LDAP_OPT_KEEPCONN.
IPR:
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 notice:
Copyright 2019 Symas Corporation Redistribution and use in source and binary forms, with or without modification, are permitted only as authorized by the OpenLDAP Public License.