Env:
Ubuntu - 18.04
Python - 3.6.6
cx_Freeze - 6.1
Code:
Simple main_script.py file (example in repository - https://github.com/Yuriy-Leonov/cython_multiprocessing_issue )
import multiprocessing
if __name__ == '__main__':
print("step-1")
multiprocessing.set_start_method("spawn")
print("step-2")
multiprocessing.freeze_support()
print("step-3")
manager = multiprocessing.Manager()
print("step-4")
s_dict = manager.dict()
print("finish")
And setup.py (for cx_Freeze):
import cx_Freeze
executables = [cx_Freeze.Executable("main_script.py")]
cx_Freeze.setup(
name="Example",
options={
"build_exe": {
"replace_paths": [("*", "")]
},
},
executables=executables
)
Issue:
After building executable file via command python setup.py build
I ran it and console log contained following:
step-1
step-2
step-3
step-1
step-2
step-3
step-1
step-2
step-3
...
And infinite processes are spawned.
I understand that multiprocessing.Manager()
should spawn "server" process. But can't get clue of current behaviorand and how to force it to create "shared dict"
Important:
multiprocessing.set_start_method("spawn")
can't be changed and required due to main program behavior.
Question:
How to achive of creating manager.dict()
in current configuration?
PS:
There is no issue if run with regular python <filename>
(obvious)