当我按 Ctrl-C 退出我的应用程序时,我看到了这个
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.6/multiprocessing/util.py", line 269, in _exit_function
p.join()
File "/usr/lib/python2.6/multiprocessing/process.py", line 119, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 117, in wait
return self.poll(0)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 106, in poll
pid, sts = os.waitpid(self.pid, flag)
OSError: [Errno 4] Interrupted system call
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.6/multiprocessing/util.py", line 269, in _exit_function
p.join()
File "/usr/lib/python2.6/multiprocessing/process.py", line 119, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 117, in wait
return self.poll(0)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 106, in poll
pid, sts = os.waitpid(self.pid, flag)
OSError: [Errno 4] Interrupted system call
我在自己的东西上使用扭曲,
我使用以下代码注册了信号 Ctrl-C
def sigHandler(self, arg1, arg2):
if not self.backuped:
self.stopAll()
else:
out('central', 'backuped ALREADY, now FORCE exiting')
exit()
def stopAll(self):
self.parserM.shutdown()
for each in self.crawlM:
each.shutdown()
self.backup()
reactor.stop()
当他们向其他人发出关闭的信号时,它会试图告诉他们很好地关闭
exit = multiprocessing.Event()
def shutdown(self):
self.exit.set()
我所有的流程都以某种形式存在,
def run(self):
while not self.exit.is_set():
do something
out('crawler', 'crawler exited sucessfully')
知道这个错误是什么吗?只有当我有多个特定线程的实例时,我才会得到它。