我启用了调试功能,并尝试从父进程中终止并重新启动子进程。
我已经在类中打开了 A 和 B 并添加了一个关闭方法来杀死失败的进程,在此之后,如果我尝试 A.start() 或 A.run() 这个错误出现'不能启动一个进程两次'。这是什么方法?该进程已死,没有其他进程在运行。
如果我调用 multiprocessing.active_childre() 进程不会重新启动但得到这个输出:
<Process(SyncManager-2, started)>, <Process(SyncManager-1, started)>, <Process(SyncManager-3, started)>]
[INFO/MainProcess] process shutting down
[DEBUG/MainProcess] running all "atexit" finalizers with priority >= 0
[SUBDEBUG/MainProcess] calling <Finalize object, callback=_decref, args=(Token(typeid='Value', address='/tmp/pymp-2ObnP1/listener-aIRbnG', id='7f28db9b6190'), '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28db9a6718>, <multiprocessing.util.ForkAwareLocal object at 0x7f28db98da10>, ProcessLocalSet(['7f28db9b6190']), <function Client at 0x7f28db99b9b0>), exitprority=10>
[SUBDEBUG/MainProcess] finalizer calling <function _decref at 0x7f28db99faa0> with args (Token(typeid='Value', address='/tmp/pymp-2ObnP1/listener-aIRbnG', id='7f28db9b6190'), '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28db9a6718>, <multiprocessing.util.ForkAwareLocal object at 0x7f28db98da10>, ProcessLocalSet(['7f28db9b6190']), <function Client at 0x7f28db99b9b0>) and kwargs {}
[DEBUG/MainProcess] DECREF '7f28db9b6190'
[DEBUG/MainProcess] thread 'Dummy-1' has no more proxies so closing conn
[SUBDEBUG/MainProcess] calling <Finalize object, callback=_decref, args=(Token(typeid='Value', address='/tmp/pymp-EfUPHj/listener-hPdyzk', id='7f28db9b30d0'), '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28db9a6638>, <multiprocessing.util.ForkAwareLocal object at 0x7f28db98d9a8>, ProcessLocalSet(['7f28db9b30d0']), <function Client at 0x7f28db99b9b0>), exitprority=10>
[SUBDEBUG/MainProcess] finalizer calling <function _decref at 0x7f28db99faa0> with args (Token(typeid='Value', address='/tmp/pymp-EfUPHj/listener-hPdyzk', id='7f28db9b30d0'), '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28db9a6638>, <multiprocessing.util.ForkAwareLocal object at 0x7f28db98d9a8>, ProcessLocalSet(['7f28db9b30d0']), <function Client at 0x7f28db99b9b0>) and kwargs {}
[DEBUG/MainProcess] DECREF '7f28db9b30d0'
[DEBUG/MainProcess] thread 'Dummy-1' has no more proxies so closing conn
[SUBDEBUG/MainProcess] calling <Finalize object, callback=_decref, args=(Token(typeid='list', address='/tmp/pymp-W6FZ5G/listener-V4fUuw', id='7f28db9b3908'), '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28ddc2f7f8>, <multiprocessing.util.ForkAwareLocal object at 0x7f28db98d940>, ProcessLocalSet(['7f28db9acf38', '7f28db9b3908']), <function Client at 0x7f28db99b9b0>), exitprority=10>
[SUBDEBUG/MainProcess] finalizer calling <function _decref at 0x7f28db99faa0> with args (Token(typeid='list', address='/tmp/pymp-W6FZ5G/listener-V4fUuw', id='7f28db9b3908'), '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28ddc2f7f8>, <multiprocessing.util.ForkAwareLocal object at 0x7f28db98d940>, ProcessLocalSet(['7f28db9acf38', '7f28db9b3908']), <function Client at 0x7f28db99b9b0>) and kwargs {}
[DEBUG/MainProcess] DECREF '7f28db9b3908'
[SUBDEBUG/MainProcess] calling <Finalize object, callback=_decref, args=(Token(typeid='list', address='/tmp/pymp-W6FZ5G/listener-V4fUuw', id='7f28db9acf38'), '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28ddc2f7f8>, <multiprocessing.util.ForkAwareLocal object at 0x7f28db98d940>, ProcessLocalSet(['7f28db9acf38']), <function Client at 0x7f28db99b9b0>), exitprority=10>
[SUBDEBUG/MainProcess] finalizer calling <function _decref at 0x7f28db99faa0> with args (Token(typeid='list', address='/tmp/pymp-W6FZ5G/listener-V4fUuw', id='7f28db9acf38'), '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28ddc2f7f8>, <multiprocessing.util.ForkAwareLocal object at 0x7f28db98d940>, ProcessLocalSet(['7f28db9acf38']), <function Client at 0x7f28db99b9b0>) and kwargs {}
[DEBUG/MainProcess] DECREF '7f28db9acf38'
[DEBUG/MainProcess] thread 'Dummy-1' has no more proxies so closing conn
[SUBDEBUG/MainProcess] calling <Finalize object, callback=_finalize_manager, args=(<Process(SyncManager-3, started)>, '/tmp/pymp-2ObnP1/listener-aIRbnG', '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28db9a6718>, <function Client at 0x7f28db99b9b0>), exitprority=0>
[SUBDEBUG/MainProcess] finalizer calling <function _finalize_manager at 0x7f28db99f5f0> with args (<Process(SyncManager-3, started)>, '/tmp/pymp-2ObnP1/listener-aIRbnG', '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28db9a6718>, <function Client at 0x7f28db99b9b0>) and kwargs {}
[INFO/MainProcess] sending shutdown message to manager
[SUBDEBUG/MainProcess] calling <Finalize object, callback=_finalize_manager, args=(<Process(SyncManager-2, started)>, '/tmp/pymp-EfUPHj/listener-hPdyzk', '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28db9a6638>, <function Client at 0x7f28db99b9b0>), exitprority=0>
[SUBDEBUG/MainProcess] finalizer calling <function _finalize_manager at 0x7f28db99f5f0> with args (<Process(SyncManager-2, started)>, '/tmp/pymp-EfUPHj/listener-hPdyzk', '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28db9a6638>, <function Client at 0x7f28db99b9b0>) and kwargs {}
[INFO/MainProcess] sending shutdown message to manager
[SUBDEBUG/MainProcess] calling <Finalize object, callback=_finalize_manager, args=(<Process(SyncManager-1, started)>, '/tmp/pymp-W6FZ5G/listener-V4fUuw', '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28ddc2f7f8>, <function Client at 0x7f28db99b9b0>), exitprority=0>
[SUBDEBUG/MainProcess] finalizer calling <function _finalize_manager at 0x7f28db99f5f0> with args (<Process(SyncManager-1, started)>, '/tmp/pymp-W6FZ5G/listener-V4fUuw', '\xc0\xad;K\xce2\xb1\x0f\x17\xe4|f\x14\x1a\x11\xc0\x89 n\x00\x00.\x19B0\xcd%\xac \x83\x8e\x87', <multiprocessing.managers.State object at 0x7f28ddc2f7f8>, <function Client at 0x7f28db99b9b0>) and kwargs {}
[INFO/MainProcess] sending shutdown message to manager
[DEBUG/MainProcess] running the remaining "atexit" finalizers