[issue35999] multpirocessing.Process alive after SIGTERM on parent

Irit Katriel report at bugs.python.org
Sat Dec 11 13:15:59 EST 2021


Irit Katriel <iritkatriel at gmail.com> added the comment:

This example is not working for me on 3.11:

>>> from multiprocessing import Process
>>> from time import sleep
>>> from os import getpid
>>> 
>>> def log(daemon_mode):
...     while True:
...         print('worker %i %s' % (getpid(), daemon_mode))
...         sleep(3)
... 
>>> 
>>> print('parent pid %i' % getpid())
parent pid 77378
>>> 
>>> a = Process(target=log, args=(0,), daemon=False)
>>> a.start()
>>> <frozen importlib._bootstrap>:744: DeprecationWarning: BuiltinImporter.module_repr() is deprecated and slated for removal in Python 3.12
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/iritkatriel/src/cpython-654/Lib/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/iritkatriel/src/cpython-654/Lib/multiprocessing/spawn.py", line 126, in _main
    self = reduction.pickle.load(from_parent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: Can't get attribute 'log' on <module '__main__' (built-in)>

----------
nosy: +iritkatriel

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35999>
_______________________________________


More information about the Python-bugs-list mailing list