Issue 8985 - Fix of an assertion error in back-asyncmeta during restart of remote target
Summary: Fix of an assertion error in back-asyncmeta during restart of remote target
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.5.4
Hardware: All All
: --- normal
Target Milestone: 2.5.0
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-28 17:00 UTC by Nadezhda Ivanova
Modified: 2020-10-14 21:18 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nadezhda Ivanova 2019-02-28 17:00:54 UTC
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.
Comment 1 Quanah Gibson-Mount 2019-02-28 17:28:34 UTC
--On Thursday, February 28, 2019 5:00 PM +0000 nivanova@symas.com wrote:

> 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:

Thanks for the report, applied to git master.

Warm regards,
Quanah


--

Quanah Gibson-Mount
Product Architect
Symas Corporation
Packaged, certified, and supported LDAP solutions powered by OpenLDAP:
<http://www.symas.com>


Comment 2 OpenLDAP project 2019-02-28 17:29:00 UTC
Fixed in git master
Comment 3 Quanah Gibson-Mount 2019-02-28 17:29:00 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs