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 1357682 - RHDS fails to start with message: "Failed to delete old semaphore for stats file"
Summary: RHDS fails to start with message: "Failed to delete old semaphore for stats f...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base
Version: 7.0
Hardware: All
OS: Linux
unspecified
high
Target Milestone: pre-dev-freeze
: 7.4
Assignee: wibrown@redhat.com
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-18 21:08 UTC by Chinmay Paradkar
Modified: 2020-09-13 21:39 UTC (History)
8 users (show)

Fixed In Version: 389-ds-base-1.3.6.1-15.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 21:10:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch for issue. (2.33 KB, application/mbox)
2017-05-12 00:19 UTC, wibrown@redhat.com
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github 389ds 389-ds-base issues 1778 0 None closed Misleading error: Failed to delete old semaphore 2021-02-04 22:49:59 UTC
Red Hat Product Errata RHBA-2017:2086 0 normal SHIPPED_LIVE 389-ds-base bug fix and enhancement update 2017-08-01 18:37:38 UTC

Description Chinmay Paradkar 2016-07-18 21:08:10 UTC
Description of problem:
RHDS fails to start with following messages in error log file.

[11/Jul/2016:10:37:06 -0400] - Failed to delete old semaphore for stats file (/var/run/dirsrv/slapd-userprod.stats). Error 13 (Permission denied).
[11/Jul/2016:10:48:57 -0400] - 389-Directory/1.2.11.15 B2016.063.2110 starting up

Version-Release number of selected component (if applicable):
redhat-ds-base-9.1.2-1.el6dsrv.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Seems to be a standard DS installation
2.
3.

Actual results:
Directory server fails to start.

Expected results:
Normal operation.

Additional info:
The workaround is to delete the "/dev/shm/sem.slapd-userprod.stats" file as noted by this bug about log mislabeling https://fedorahosted.org/389/ticket/48538

Comment 2 Abhinay Reddy Peddireddy 2016-10-30 07:33:24 UTC
Need info to update customer. 

As per the recent work-flow we should not send any template response on the case without contacting Engineering team for exact status and update. 

Can someone let me know any recent update on this bugzilla ? When this case will be assigned ? Any ETA ?

Comment 5 Amita Sharma 2017-05-02 09:03:57 UTC
I am getting this error -
==========================

Directory Manager DN [cn=Directory Manager]: 
Password: 
Password (confirm): 
/usr/bin/pwdhash-bin: error while loading shared libraries: libslapd.so.0: cannot open shared object file: No such file or directory
Could not import LDIF file '/tmp/ldifaC9BGA.ldif'.  Error: 32512.  Output: importing data ...
/usr/sbin/ns-slapd: error while loading shared libraries: libnunc-stans.so.0: cannot open shared object file: No such file or directory

Error: Could not create directory server instance 'test'.
Exiting . . .
Log file is '/tmp/setupOY4Gh7.log'

NOTE - this is only on one test machine that I hit this error and I tried re-installing 389 RPMs but error does not go away. I have the test machine, if that is needed.

Comment 6 Viktor Ashirov 2017-05-05 19:55:58 UTC
[05/May/2017:10:34:57.620062305 +0200] - EMERG - snmp_collator_create_semaphore - Failed to delete old semaphore for stats file (/slapd-rhel7ds.stats). Error 13 (Permission denied).

Path is still wrong, marking as ASSIGNED.

Comment 7 wibrown@redhat.com 2017-05-11 23:43:52 UTC
It looks like there are two issues here.

The first is the incorrect libraries that Amita is seeing. Can you give us access to the machine? I think that there is something odd going on here. If it's repeatable, mreynolds may know more as he did the packaging lately. 

The second is the error that Viktor is seeing. I'm a bit confused about this, so let me have another look at the code.

Comment 8 wibrown@redhat.com 2017-05-11 23:56:46 UTC
okay, here is the code:

###
    /* First just try to create the semaphore.  This should usually just work. */
    if ((stats_sem = sem_open(stats_sem_name, O_CREAT | O_EXCL, SLAPD_DEFAULT_FILE_MODE, 1)) == SEM_FAILED) {
        if (errno == EEXIST) {
            /* It appears that we didn't exit cleanly last time and left the semaphore
             * around.  Recreate it since we don't know what state it is in. */
            if (sem_unlink(stats_sem_name) != 0) {
                slapi_log_err(SLAPI_LOG_EMERG, "snmp_collator_create_semaphore",
                        "Failed to delete old semaphore for stats file (%s). "
                        "Error %d (%s).\n", stats_sem_name, errno, slapd_system_strerror(errno) );
                exit(1);
            }

###

So perhaps I made a mistake here. sem_open takes a semaphore *name*, not a path. Looking at the man page it says:

       Named semaphores
              A named semaphore is identified by a name of the form /somename; that is, a null-terminated string of up to NAME_MAX-4 (i.e., 251) characters consisting of an initial slash, followed  by  one
              or more characters, none of which are slashes.  Two processes can operate on the same named semaphore by passing the same name to sem_open(3).

AND

   Accessing named semaphores via the file system
       On  Linux,  named  semaphores  are  created  in  a virtual file system, normally mounted under /dev/shm, with names of the form sem.somename.  (This is the reason that semaphore names are limited to
       NAME_MAX-4 rather than NAME_MAX characters.)

So the error message is now indeed wrong as I made a mistake in the reading of the api. 

I'll reopen https://pagure.io/389-ds-base/issue/48538 and fix this.

Comment 9 wibrown@redhat.com 2017-05-12 00:19:53 UTC
Created attachment 1278051 [details]
patch for issue.

Pagure is exploding right now, so here is the patch to review.

Comment 10 Viktor Ashirov 2017-05-14 14:38:26 UTC
Now the error message points to
/dev/shm/slapd-master_1.stats

while the actual file name is (note the "sem." prefix):
/dev/shm/sem.slapd-master_1.stats

Comment 12 Amita Sharma 2017-05-30 09:41:58 UTC
[root@qeos-37 upstream]# rpm -qa | grep 389
389-ds-base-libs-1.3.6.1-15.el7.x86_64
389-ds-base-1.3.6.1-15.el7.x86_64
389-ds-base-snmp-1.3.6.1-15.el7.x86_64
389-ds-base-debuginfo-1.3.6.1-15.el7.x86_64


[root@qeos-37 upstream]# systemctl stop dirsrv@qeos-37
[root@qeos-37 upstream]# touch /dev/shm/sem.slapd-qeos-37.stats
[root@qeos-37 upstream]# systemctl start dirsrv@qeos-37
Job for dirsrv failed because the control process exited with error code. See "systemctl status dirsrv" and "journalctl -xe" for details.

Logs -
[30/May/2017:05:36:30.789082275 -0400] - INFO - main - slapd stopped.
[30/May/2017:05:37:22.820057668 -0400] - INFO - main - 389-Directory/1.3.6.1 B2017.143.155 starting up
[30/May/2017:05:37:22.821701509 -0400] - EMERG - snmp_collator_create_semaphore - Failed to delete old semaphore for stats file (/dev/shm/sem.slapd-qeos-37.stats). Error 13 (Permission denied).
[30/May/2017:05:38:37.519273936 -0400] - INFO - main - 389-Directory/1.3.6.1 B2017.143.155 starting up
[30/May/2017:05:38:37.520886181 -0400] - EMERG - snmp_collator_create_semaphore - Failed to delete old semaphore for stats file (/dev/shm/sem.slapd-qeos-37.stats). Error 13 (Permission denied).

[root@qeos-37 upstream]# rm -rf /dev/shm/sem.slapd-qeos-37.stats
[root@qeos-37 upstream]# /usr/lib64/dirsrv/slapd-qeos-37/start-slapd 
[root@qeos-37 upstream]#

Comment 13 errata-xmlrpc 2017-08-01 21:10:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2086


Note You need to log in before you can comment on or make changes to this bug.