#50990 Ticket 50989 - ignore pid when it is ourself in protect_db
Closed by spichugi. Opened by firstyear.
firstyear/389-ds-base 50989-existing-process-start  into  master

Download 50990.patch

Bug Description: In protect_db.c, there are some cases (especially containers)
where a pid number can be re-used. Following a bad shutdown, the lock files
in /run/lock/{export,import,server}/* remain, and the pid they hold could
be allocated to ourself. When this occurs, the server fails to start.

Fix Description: If the pid of the lock file is our own pid, that is proof
that the previous pid/lock file can not exist, and therfore it is safe to
proceed with the startup.

https://pagure.io/389-ds-base/issue/50989

Author: William Brown william@blackhats.net.au

Review by: ???

My understanding is that, unless on error condition (disk full), the pid file is removed by systemd (PIDfile option). An other option to remove the pid file on container could be to let slapd_daemon do that task, having get_shutdown returning SLAPI_SHUTDOWN_CONTAINER.

The issue is not the pid file, but the db locks in /run/lock/{export,import,server}/*. The pid file is not used to check if another instance is running, but to allow external processes to find out pid. However the files in /run/lock/{export,import,server}/* as used by the server to say "hey, does another pid of DS exist?". And that's what's causing the problem here :)

So I think that this is still the correct approach, given the way the pid's and pid files are tracked.

Any other comments @tbordaz ? I have someone in the community using docker that has hit this issue now too :)

@tbordaz ping

@firstyear thanks for you explanation. Patch looks good. ACK

rebased onto 8b3f4ca6d3c28262ece7079eb77968be445f3cab

Pull-Request has been merged by firstyear

   14c7a3c89..50f3f34d7  389-ds-base-1.4.2 -> 389-ds-base-1.4.2
   d4118370a..23e0d6490  389-ds-base-1.4.3 -> 389-ds-base-1.4.3

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/4043

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

Metadata