https://bugs.openldap.org/show_bug.cgi?id=9283
Issue ID: 9283 Summary: Mutex leak in backend.c`backend_db_init() Product: OpenLDAP Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: --- Component: slapd Assignee: bugs@openldap.org Reporter: grapvar@gmail.com Target Milestone: ---
@backend_db_init: if bi_db_init() fails, but [BackendDB *be] is not listed in [slap_be_head backendDB] list of backends, then be->be_pcl_mutex is not destroyed.
| BackendDB * | backend_db_init( ... ) | { | ... | ldap_pvt_thread_mutex_init( &be->be_pcl_mutex ); | ... | if ( bi->bi_db_init ) | rc = bi->bi_db_init( be, cr ); | | if ( rc != 0 ) { | if ( !b0 ) { | ... | ldap_pvt_thread_mutex_destroy( &be->be_pcl_mutex ); | ch_free( be );
Additionally, it does not look like that owner of [b0] cares about destroying this mutex.
https://bugs.openldap.org/show_bug.cgi?id=9283
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Howard Chu hyc@openldap.org --- Not a bug. When init'ng a private backend, the caller is responsible for cleanup. See for example https://git.openldap.org/openldap/openldap/-/blob/master/servers/slapd/overl...
Closing this.
https://bugs.openldap.org/show_bug.cgi?id=9283
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED
https://bugs.openldap.org/show_bug.cgi?id=9283
Konstantin Andreev grapvar@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |--- Status|VERIFIED |UNCONFIRMED
--- Comment #2 from Konstantin Andreev grapvar@gmail.com --- (In reply to Howard Chu from comment #1)
When init'ng a private backend, the caller is responsible for cleanup. See for example | translucent_db_destroy( BackendDB *be, ConfigReply *cr ) | { | ... | ldap_pvt_thread_mutex_destroy( &ov->db.be_pcl_mutex );
Other callers disagree. There are no destroy complements for this:
| bconfig.c`config_setup_ldif( ... ) { | ... | if ( backend_db_init( "ldif", &cfb->cb_db, -1, NULL ) == NULL ) | return 1;
and this
| overlays/pcache.c`pc_cf_gen( ... ) { | ... | if ( !backend_db_init( c->argv[1], &cm->db, -1, NULL )) { | // error report | return( 1 );
whatever it could mean.
https://bugs.openldap.org/show_bug.cgi?id=9283
--- Comment #3 from Howard Chu hyc@openldap.org --- (In reply to Konstantin Andreev from comment #2)
(In reply to Howard Chu from comment #1)
When init'ng a private backend, the caller is responsible for cleanup. See for example | translucent_db_destroy( BackendDB *be, ConfigReply *cr ) | { | ... | ldap_pvt_thread_mutex_destroy( &ov->db.be_pcl_mutex );
Other callers disagree. There are no destroy complements for this:
| bconfig.c`config_setup_ldif( ... ) { | ... | if ( backend_db_init( "ldif", &cfb->cb_db, -1, NULL ) == NULL ) | return 1;
The config backend cannot be destroyed without shutting down slapd, therefore any potential leaks are irrelevant.
and this
| overlays/pcache.c`pc_cf_gen( ... ) { | ... | if ( !backend_db_init( c->argv[1], &cm->db, -1, NULL )) { | // error report | return( 1 );
whatever it could mean.
Patches welcome.
https://bugs.openldap.org/show_bug.cgi?id=9283
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.5.0
https://bugs.openldap.org/show_bug.cgi?id=9283
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Mutex leak in |Mutex leak in backend.c |backend.c`backend_db_init() |backend_db_init()
https://bugs.openldap.org/show_bug.cgi?id=9283
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|2.5.0 |2.5.1
https://bugs.openldap.org/show_bug.cgi?id=9283
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|2.5.1 |2.5.3
https://bugs.openldap.org/show_bug.cgi?id=9283
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
https://bugs.openldap.org/show_bug.cgi?id=9283
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED Target Milestone|2.5.3 |---