Comment 29 for bug 1327946

Revision history for this message
Yuriy Taraday (yorik-sar) wrote :

I think we got a bit mixed up in APIs here.

semctl is part of SysV IPC API that provide SEM_UNDO as a way to deal with spontaneous process death. If we're going with SysV IPC we don't need to look for PIDs since we won't get locked by sudden process death.

On the other hand POSIX IPC don't provide such simple mechanism. So we might have to invent something there (and I don't see much options but basically reinventing some parts of file locking or SysV-like API).

We should get an understanding of which way are we taking here. I see 3 options:

a) revert to file locks.

It'll require yet another behavior change in lockutils and more burden on operators.

b) stick with POSIX semaphores, add some mechanism to avoid waiting on dead processes.

It'll require some elaborate plan to atomically store PID of process holding the lock and verify if the process holding the lock is running.

c) use SysV semaphores.

With this option we don't need to care about cleanup after a process death as kernel does that for us. The only Issue here (a negligible one from my point of view) is that there are harder limit on the range of keys - there can be only 2^64 of them.

I'm all for option c.