Comments (7)
What signal did you use to kill the process?
from daemons.
SIGKILL
from daemons.
Ah, yeah. SIGKILL terminates the process without allowing it to run the cleanup logic. It's a known shortcoming of using signal trapping to perform pidfile cleanup. I think something like psutils would be a good alternative. I'm trying to keep the project dependency free so I will likely make psutils an optional driver for pid management.
Is using SIGKILL a requirement for your project? If not you should consider using another signal such as SIGTERM as it will properly tigger the cleanup logic and remove the pidfile.
from daemons.
Ah, yeah. SIGKILL terminates the process without allowing it to run the cleanup logic
it's not a secret
I'm trying to keep the project dependency free so I will likely make psutils an optional driver for pid management.
it would be great
Is using SIGKILL a requirement for your project?
I think that this is possible as the external impact
from daemons.
The problem isn't just if the daemon is killed. The same issue happens if it dies unexpectedly. Or the host system crashes or loses power. Or any number of other possibilities. That is why full pidfile handling needs to test that the pid is valid.
I need to test portability of the method, but on POSIX systems, there is no need for external dependencies. It's as easy as something like
try:
os.kill(pid, 0)
except OSError as e:
if e.errno == errno.EPERM:
print("pid %d is running under a different username" % pid)
elif e.errno != errno.ESRCH:
print("kill of pid %d failed with error %s" % (pid, e.strerror))
else:
print("pid %d is running" % pid)
Windows supports os.kill in 2.7 onwards. I'll see if it works there.
from daemons.
The code as it stands doesn't work on Windows for a number of unrelated reasons.
The signal handling needs SIGQUIT removed since it doesn't exist on Windows (trivial), but then daemonize fails because os.fork doesn't exist either.
As such, I already have a fix (plus tests) for the pidfile handling in my clone. I'll submit a pull request.
from daemons.
Thanks to @tenortim I can finally close this bug!
from daemons.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from daemons.