The Pasteur daemon will not be closed because it cannot read its own pid file

TL DR version . When I ask Pasteur to stop the daemon, he cannot read his own file, which he uses to track his process ID.

Longer version :

I am running Paster (pastescript 1.7.3) on Python 2.7.1 on Windows Vista.

My first surprise is the launch of a simple website:

>paster serve development.ini
Starting server in PID 15184.
serving on http://127.0.0.1:5000

I expected to find the paster.pid file in the same directory, but I do not. It’s strange. Do not pay attention to it, let's make it explicit by killing this process and starting again.

>paster serve development.ini --pid-file=my.pid
Starting server in PID 20884.
serving on http://127.0.0.1:5000

This time it creates a file called my.pid. In another command window, I can type:

 >type my.pid
 20884

The website is being served successfully and the task manager confirms that there is a python process with PID 20884.

paster :

>paster serve development.ini --status --pid-file=my.pid
PID None in my.pid is not running

>type my.pid
20884

. , PID my.pid None, .

.

>paster serve --stop-daemon --pid-file=my.pid
PID in my.pid is not valid (deleting)

>type my.pid
The system cannot find the file specified.

, my.pid, .

.

- , @Lennart Regebro , . , .

?

+3
1

script (serve.py) PID:

pid = read_pidfile(pidfile)
if pid:
    try:
        os.kill(int(pid), 0)
        return pid
    except OSError, e:
        if e.errno == errno.EPERM:
            return pid
return None

, POSIX, 0 , .

Windows kill; Python TerminateProcess. os.kill paster script , POSIX, Cygwin ( POSIX Windows) Linux.

+2

Source: https://habr.com/ru/post/1718986/


All Articles