[pywin32-bugs] [ pywin32-Bugs-1273738 ] atexit not called for pythonservice (win32)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2007-10-18 20:53:43
|
Bugs item #1273738, was opened at 2005-08-26 01:52 Message generated for change (Comment added) made by richardb You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1273738&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Hari Krishna Dara (haridsv) Assigned to: Nobody/Anonymous (nobody) Summary: atexit not called for pythonservice (win32) Initial Comment: I have a couple of functions registered with atexit which work fine when the program is executed on command-line. But when I run the same as a windows service, and stop the service using service interface, these hooks never get call backs. The service does exit normally (at least my program doesn't do os._exit() and there are no exceptions). I am using ActiveState's distribution of python, but I would imagine this is non-specific. Here is the version information: ActivePython 2.4.1 Build 247 (ActiveState Corp.) based on Python 2.4.1 (#65, Jun 20 2005, 17:01:55) [MSC v.1310 32 bit (Intel)] on win32 As a workaround I am calling the atexit._run_exitfuncs() manually before returning from SvcDoRun() for now. ---------------------------------------------------------------------- Comment By: Richard Boulton (richardb) Date: 2007-10-18 20:53 Message: Logged In: YES user_id=9565 Originator: NO This issue is still present. I have a minimal example which reproduces it which I will attach to this bug shortly. Note - regarding "woodsplitter"'s comment - I don't think this is related to the issue linked to there. As far as I can tell, the issue there is related to atexit being called in an order different to that expected, due to threading issues. In my minimal example, I have no threads involved; all my example code runs in SvcDoRun, in a single thread. I believe the problem is simply that, in src/PythonService.cpp, Py_Finalize() is never called. For example, in the main() function, Py_Initialize() is called near the start, but a corresponding Py_Finalize() is not called. ---------------------------------------------------------------------- Comment By: Hari Krishna Dara (haridsv) Date: 2006-01-12 19:09 Message: Logged In: YES user_id=344432 Doesn't seem to be. In my case I don't see a call back at all, so the issue is not about when it gets called. ---------------------------------------------------------------------- Comment By: David S. Rushby (woodsplitter) Date: 2006-01-12 18:50 Message: Logged In: YES user_id=414645 I wonder if this bug is related to the following issue? http://groups.google.com/group/comp.lang.python/browse_thread/thread/fe9e426650764ed9/972ecadc2d6fcf5b#972ecadc2d6fcf5b ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1273738&group_id=78018 |