This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: using os.fork() and import user's modules results in errors
Type: behavior Stage:
Components: None Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: michaeluc, r.david.murray
Priority: normal Keywords:

Created on 2012-08-15 01:30 by michaeluc, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mydaemon.py michaeluc, 2012-08-15 01:30 add any import yourscript.py in the beginning and you will have errors
Messages (3)
msg168251 - (view) Author: Michael (michaeluc) Date: 2012-08-15 01:30
if I import any python script in the beginning of the code in then I haver next errors:

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/multiprocessing/util.py", line 295, in _exit_function
    p.join()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 143, in join
    assert self._parent_pid == os.getpid(), 'can only join a child process'
AssertionError: can only join a child process
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/multiprocessing/util.py", line 295, in _exit_function
    p.join()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 143, in join
    assert self._parent_pid == os.getpid(), 'can only join a child process'
AssertionError: can only join a child process
msg168252 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-08-15 01:37
The example you uploaded doesn't call multiprocessing, yet the traceback you show does.  Can you provide more details on what you are actually doing?  Note that if you are importing a module that does a fork when it is imported, you are doing something wrong.
msg168256 - (view) Author: Michael (michaeluc) Date: 2012-08-15 02:56
thanks David,
scripts which I imported were relying on some librarary which I did not understand. I was able to get rid of it and I don't have these errors any more. It was bug in my program. Thank you again.
History
Date User Action Args
2022-04-11 14:57:34adminsetgithub: 59864
2012-08-15 02:56:58michaelucsetstatus: open -> closed
resolution: fixed
messages: + msg168256
2012-08-15 01:37:04r.david.murraysetnosy: + r.david.murray
messages: + msg168252
2012-08-15 01:30:19michaeluccreate