Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 948056

Summary: segfault in db2ldif
Product: Red Hat Enterprise Linux 7 Reporter: Nathan Kinder <nkinder>
Component: 389-ds-baseAssignee: Rich Megginson <rmeggins>
Status: CLOSED CURRENTRELEASE QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: amsharma, mreynolds, nhosoi, sramling
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.1.2-1.el7 Doc Type: Bug Fix
Doc Text:
Cause: An incomplete CLEANALLRUV task is present when doing an offline db2ldif. Consequence: The CLEANALLRUV task starts up, and triggers a server crash because it tries to trim the changelog - which is not started during an offline db2ldif. Fix: Prevent the CLEANALLRUV task from stating when performing offline tasks. Result: Offline tasks, like db2ldif, do not crash the server.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 13:18:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nathan Kinder 2013-04-03 21:06:16 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/47311

Seeing a segfault trying to do an offline backup using db2ldif.

I'm not entirely sure how I got my instance into whatever state it is in. I believe it had a replica at one point which I deleted AFTER it was already gone. This was done in the context of IPA so we create a CLEANALLRUV task to remove things.

Listing all the tasks after startup returns nothing.

{{{
# gdb /usr/sbin/ns-slapd
...
(gdb) run  db2ldif -D /etc/dirsrv/slapd-GREYOAK-COM -r -n userRoot -a /tmp/test.ldif
Starting program: /usr/sbin/ns-slapd db2ldif -D /etc/dirsrv/slapd-GREYOAK-COM -r -n userRoot -a /tmp/test.ldif
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[02/Apr/2013:13:27:13 -0400] - /etc/dirsrv/slapd-GREYOAK-COM/dse.ldif: nsslapd-maxdescriptors: nsslapd-maxdescriptors: invalid value "8192", maximum file descriptors must range from 1 to 4096 (the current process limit).  Server will use a setting of 4096.
[02/Apr/2013:13:27:13 -0400] - Config Warning: - nsslapd-maxdescriptors: invalid value "8192", maximum file descriptors must range from 1 to 4096 (the current process limit).  Server will use a setting of 4096.
[02/Apr/2013:13:27:13 -0400] - userRoot: entry cache size: 10485760B; db size: 344064B
[02/Apr/2013:13:27:13 -0400] - ipaca: entry cache size: 10485760B; db size: 319488B
[02/Apr/2013:13:27:13 -0400] - Total entry cache size: 20971520B; dbcache size: 10000000B; available memory size: 1001832448B
[02/Apr/2013:13:27:13 -0400] - Detected Disorderly Shutdown last time Directory Server was running, recovering database.
[New Thread 0x7f6a2f9a5700 (LWP 24949)]
[New Thread 0x7f6a2f1a4700 (LWP 24950)]
[New Thread 0x7f6a2e9a3700 (LWP 24951)]
[New Thread 0x7f6a2e1a2700 (LWP 24952)]
[02/Apr/2013:13:27:13 -0400] ldbm_usn_init - backend: userRoot (global mode)
[02/Apr/2013:13:27:13 -0400] ldbm_usn_init - backend: ipaca (global mode)
[02/Apr/2013:13:27:13 -0400] schema-compat-plugin - warning: no entries set up under cn=computers, cn=compat,dc=greyoak,dc=com
[02/Apr/2013:13:27:13 -0400] schema-compat-plugin - warning: no entries set up under cn=ng, cn=compat,dc=greyoak,dc=com
[02/Apr/2013:13:27:13 -0400] schema-compat-plugin - warning: no entries set up under ou=sudoers,dc=greyoak,dc=com
[New Thread 0x7f6a2d9a1700 (LWP 24953)]
[02/Apr/2013:13:27:13 -0400] - Skipping CoS Definition cn=Password Policy,cn=accounts,dc=greyoak,dc=com--no CoS Templates found, which should be added before the CoS Definition.
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - CleanAllRUV Task: cleanAllRUV task found, resuming the cleaning of rid(3)...
[New Thread 0x7f6a2d1a0700 (LWP 24954)]
[New Thread 0x7f6a2c99f700 (LWP 24955)]
[New Thread 0x7f6a2c97e700 (LWP 24956)]
[New Thread 0x7f6a27fff700 (LWP 24957)]
[New Thread 0x7f6a277fe700 (LWP 24958)]
ldiffile: /tmp/test.ldif
[02/Apr/2013:13:27:13 -0400] - export userRoot: Processed 245 entries (100%).
[Thread 0x7f6a277fe700 (LWP 24958) exited]
[Thread 0x7f6a2c97e700 (LWP 24956) exited]
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Cleaning rid (3)...
[Thread 0x7f6a27fff700 (LWP 24957) exited]
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Waiting to process all the updates from the deleted replica...
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Waiting for all the replicas to be online...
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Waiting for all the replicas to receive all the deleted replica updates...
[Thread 0x7f6a2c99f700 (LWP 24955) exited]
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Sending cleanAllRUV task to all the replicas...
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Cleaning local ruv's...
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Waiting for all the replicas to be cleaned...
[New Thread 0x7f6a2c99f700 (LWP 24959)]
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - changelog program - _cl5AddThread: invalid changelog state - 0
[02/Apr/2013:13:27:13 -0400] NSMMReplicationPlugin - changelog program - trigger_cl_trimming: failed to increment thread count NSPR error - 0

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f6a2c99f700 (LWP 24959)]
__GI___pthread_mutex_lock (mutex=0x0) at pthread_mutex_lock.c:50
50        unsigned int type = PTHREAD_MUTEX_TYPE (mutex);
Missing separate debuginfos, use: debuginfo-install audit-libs-2.2.2-2.fc18.x86_64 cyrus-sasl-gssapi-2.1.23-36.fc18.x86_64 cyrus-sasl-lib-2.1.23-36.fc18.x86_64 cyrus-sasl-md5-2.1.23-36.fc18.x86_64 cyrus-sasl-plain-2.1.23-36.fc18.x86_64 keyutils-libs-1.5.5-3.fc18.x86_64 krb5-libs-1.10.3-5.fc18.x86_64 libcom_err-1.42.5-1.fc18.x86_64 libgcc-4.7.2-8.fc18.x86_64 libicu-49.1.1-5.fc18.x86_64 libstdc++-4.7.2-8.fc18.x86_64 libuuid-2.22.1-2.4.fc18.x86_64 nspr-4.9.4-1.fc18.x86_64 nss-3.14.1-3.fc18.x86_64 nss-softokn-3.14.1-5.fc18.x86_64 nss-softokn-freebl-3.14.1-5.fc18.x86_64 nss-util-3.14.1-2.fc18.x86_64 openldap-2.4.33-3.fc18.x86_64 openssl-libs-1.0.1c-7.fc18.x86_64 pam-1.1.6-3.fc18.1.x86_64 slapi-nis-0.44-1.fc18.x86_64 sqlite-3.7.13-2.fc18.x86_64 svrcore-4.0.4-8.fc18.x86_64
(gdb) where
#0  __GI___pthread_mutex_lock (mutex=0x0) at pthread_mutex_lock.c:50
#1  0x00007f6a390f06f9 in PR_Lock () from /lib64/libnspr4.so
#2  0x00007f6a3356265a in _cl5DoTrimming (rid=rid@entry=3)
    at ldap/servers/plugins/replication/cl5_api.c:3435
#3  0x00007f6a33562c51 in trigger_cl_trimming_thread (arg=<optimized out>)
    at ldap/servers/plugins/replication/cl5_api.c:6591
#4  0x00007f6a390f5e23 in _pt_root () from /lib64/libnspr4.so
#5  0x0000003ce4e07d15 in start_thread (arg=0x7f6a2c99f700)
    at pthread_create.c:308
#6  0x0000003ce46f246d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:114
}}}

After restart the error log shows that CLEANALLRUV was attempted:

{{{
[02/Apr/2013:13:37:02 -0400] - Listening on /var/run/slapd-GREYOAK-COM.socket for LDAPI requests
[02/Apr/2013:13:37:05 -0400] slapi_ldap_bind - Error: could not send startTLS request: error -1 (Can't contact LDAP server) errno 107 (Transport endpoint is not connected)
[02/Apr/2013:13:37:11 -0400] slapi_ldap_bind - Error: could not send startTLS request: error -1 (Can't contact LDAP server) errno 107 (Transport endpoint is not connected)
[02/Apr/2013:13:37:11 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Cleaning rid (3)...
[02/Apr/2013:13:37:11 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Waiting to process all the updates from the deleted replica...
[02/Apr/2013:13:37:11 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Waiting for all the replicas to be online...
[02/Apr/2013:13:37:11 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Waiting for all the replicas to receive all the deleted replica updates...
[02/Apr/2013:13:37:11 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Sending cleanAllRUV task to all the replicas...
[02/Apr/2013:13:37:11 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Cleaning local ruv's...
[02/Apr/2013:13:37:11 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Waiting for all the replicas to be cleaned...
[02/Apr/2013:13:37:12 -0400] NSMMReplicationPlugin - CleanAllRUV Task: failed to remove replica config (16), rid (3)
[02/Apr/2013:13:37:12 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Waiting for all the replicas to finish cleaning...
[02/Apr/2013:13:37:12 -0400] NSMMReplicationPlugin - CleanAllRUV Task: Successfully cleaned rid(3).
[02/Apr/2013:13:37:23 -0400] slapi_ldap_bind - Error: could not send startTLS request: error -1 (Can't contact LDAP server) errno 107 (Transport endpoint is not connected)
[02/Apr/2013:13:37:47 -0400] slapi_ldap_bind - Error: could not send startTLS request: error -1 (Can't contact LDAP server) errno 107 (Transport endpoint is not connected)
[02/Apr/2013:13:38:35 -0400] slapi_ldap_bind - Error: could not send startTLS request: error -1 (Can't contact LDAP server) errno 107 (Transport endpoint is not connected)
}}}

Comment 1 Rich Megginson 2013-10-01 23:26:53 UTC
moving all ON_QA bugs to MODIFIED in order to add them to the errata (can't add bugs in the ON_QA state to an errata).  When the errata is created, the bugs should be automatically moved back to ON_QA.

Comment 3 Amita Sharma 2014-01-09 13:22:55 UTC
Hi Mark,

How to reproduce this issue/verification steps?
should I try to stop the server while db2ldif initiated?

Thanks,
Ami

Comment 4 Rich Megginson 2014-01-09 14:52:14 UTC
(In reply to Amita Sharma from comment #3)
> Hi Mark,
> 
> How to reproduce this issue/verification steps?
> should I try to stop the server while db2ldif initiated?
> 
> Thanks,
> Ami

You will need to have a CLEANALLRUV task running, then shutdown the server, so that the server has to write out the cleanallruv task to the dse.ldif.  Then do an offline db2lidf.

Comment 5 mreynolds 2014-01-16 13:47:55 UTC
Rich is correct.  

[1]  Setup two replicas (A and B)
[2]  Stop B
[3]  Run cleanallruv on replica A
[4]  Stop A
[5]  Run db2ldif -> db2ldif should complete and not crash.

Comment 6 Amita Sharma 2014-01-24 07:46:11 UTC
[root@dhcp201-149 ~]# tail -f /var/log/dirsrv/slapd-M1/access
[24/Jan/2014:12:48:21 +051800] conn=36 op=1 RESULT err=0 tag=107 nentries=0 etime=0
[24/Jan/2014:12:48:21 +051800] conn=36 op=2 UNBIND
[24/Jan/2014:12:48:21 +051800] conn=36 op=2 fd=64 closed - U1
[24/Jan/2014:12:48:22 +051800] conn=37 fd=64 slot=64 connection from 10.65.201.149 to 10.65.201.149
[24/Jan/2014:12:48:22 +051800] conn=37 op=0 BIND dn="cn=directory manager" method=128 version=3
[24/Jan/2014:12:48:22 +051800] conn=37 op=0 RESULT err=0 tag=97 nentries=0 etime=0 dn="cn=directory manager"
[24/Jan/2014:12:48:22 +051800] conn=37 op=1 ADD dn="cn=M3Task,cn=cleanallruv,cn=tasks,cn=config"
[24/Jan/2014:12:48:23 +051800] conn=37 op=1 RESULT err=0 tag=105 nentries=0 etime=1
[24/Jan/2014:12:48:23 +051800] conn=37 op=2 UNBIND
[24/Jan/2014:12:48:23 +051800] conn=37 op=2 fd=64 closed - U1
=============================
[root@dhcp201-149 ~]# db2ldif -Z M1 -n userRoot -a /export/example.ldif
Exported ldif file: /export/example.ldif
ldiffile: /export/example.ldif
[24/Jan/2014:12:49:57 +051800] - export userRoot: Processed 9 entries (100%).
[24/Jan/2014:12:49:57 +051800] - All database threads now stopped
=============================
[root@dhcp201-149 ~]# tail -f /var/log/dirsrv/slapd-M1/errors
[24/Jan/2014:12:48:23 +051800] NSMMReplicationPlugin - CleanAllRUV Task: Replica not online (agmt="cn=21921_to_21905" (dhcp201-149:21905))
[24/Jan/2014:12:48:23 +051800] NSMMReplicationPlugin - CleanAllRUV Task: Not all replicas online, retrying in 10 seconds...
[24/Jan/2014:12:48:23 +051800] - slapd shutting down - signaling operation threads
[24/Jan/2014:12:48:23 +051800] - slapd shutting down - closing down internal subsystems and plugins
[24/Jan/2014:12:48:23 +051800] NSMMReplicationPlugin - CleanAllRUV Task: Server shutting down.  Process will resume at server startup
[24/Jan/2014:12:48:23 +051800] - Waiting for 4 database threads to stop
[24/Jan/2014:12:48:24 +051800] - All database threads now stopped
[24/Jan/2014:12:48:24 +051800] - slapd stopped.
[24/Jan/2014:12:49:57 +051800] - export userRoot: Processed 9 entries (100%).
[24/Jan/2014:12:49:57 +051800] - All database threads now stopped

no crash found. So marking bug as VERIFIED.

Comment 7 Ludek Smid 2014-06-13 13:18:25 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.