Description

If the system crashes, leaving a stale PID file, and then creates a new process while booting back up which happens to have that PID, then MoinMoin will fail with error: [Errno 1] Operation not permitted if the new process is not owned by the user running moin (and moin is not running as root). The error occurs in daemon.py in the status function, on the line

os.kill(pid, 0)

Presumably if the process were owned by the user, or worse yet if moin were running as root, it would just kill the process. But this is not the error I saw.

Steps to reproduce

The way the bug actually occurs is by rare coincidence. But I think it could be reproduced by manually creating a pid file with the pid of some running process, and then running ./moin start (I use the standalone wiki setup).

Example

Details

I added code to print a traceback upon catching the OSError (using traceback.print_exc), and here it is:

showard@showardlt:~/work/mywiki$ ./moin start
error: [Errno 1] Operation not permitted
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/MoinMoin/server/daemon.py", line 236, in run
    func()
  File "/usr/lib/python2.4/site-packages/MoinMoin/server/daemon.py", line 88, in do_start
    running, pid = self.status()
  File "/usr/lib/python2.4/site-packages/MoinMoin/server/daemon.py", line 152, in status
    os.kill(pid, 0)
OSError: [Errno 1] Operation not permitted
error: [Errno 1] Operation not permitted

MoinMoin Version

1.5.2

OS and Version

Debian testing

Python Version

2.4.2

Server Setup

standalone

Server Details

Workaround

Delete the pid file by hand. Not a big deal, but it would be nice to at least get a more informative error message.

Discussion

Thank you for a great piece of software!

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/StalePidFileCanCoincideWithAnotherProcess (last edited 2007-10-29 19:11:47 by localhost)