[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
Richard Oudkerk shibt...@gmail.com added the comment: The docs were patched in changeset 9fa52478b32b, so I will close. -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
Richard Oudkerk shibt...@gmail.com added the comment: One issue with sys.exit() is that it only makes the current thread exit. Even when called in the main thread, the program will wait for non-daemon threads to finish. A closer equivalent to terminate() would be os.kill(os.getpid(), signal.SIGTERM). The problem with minCrashing.py on Windows is that you are inheriting from Queue which has a __reduce__ method. Your Process class is trying to use Queue.__reduce__ to pickle itself. You should really just do self._queue = Queue() instead of inheriting from Queue. -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
5houston cadab...@gmail.com added the comment: Yes, I can. This is the minCrashing.py output from python3.2a4 in windows XP sp3: Traceback (most recent call last): File c:\Python32\lib\multiprocessing\process.py, line 233, in _bootstrap self.run() File c:\Python32\lib\multiprocessing\process.py, line 87, in run if self._target: AttributeError: 'Process' object has no attribute '_target' During handling of the above exception, another exception occurred: Traceback (most recent call last): File string, line 1, in module File c:\Python32\lib\multiprocessing\forking.py, line 349, in main exitcode = self._bootstrap() File c:\Python32\lib\multiprocessing\process.py, line 249, in _bootstrap sys.stderr.write('Process %s:\n' % self.name) File c:\Python32\lib\multiprocessing\process.py, line 137, in name return self._name AttributeError: 'Process' object has no attribute '_name' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
Jesse Noller jnol...@gmail.com added the comment: Can you please expand on deeply different? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
5houston cadab...@gmail.com added the comment: Hi. I tried my code (minCrashing.py) in windows using python 3.1.2, 2.3alpha4 and 3.1.3rc1 The behaviour is deeply different from linux 3.1.2. I think it's a bug. What do you think about it? -- versions: +Python 3.2 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
Jesse Noller jnol...@gmail.com added the comment: Fine w/ committing this Ask as-is ask. You are correct in the original intent of the code. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
5houston cadab...@gmail.com added the comment: I vote for the latter. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
Ask Solem a...@opera.com added the comment: Since you can't specify the return code, `self.terminate` is less flexible than `sys.exit`. I think the original intent is clear here, the method is there for the parent to control the child. You are of course welcome to argue otherwise. By the way, I just read the code and noticed that it handles SystemExit well, and supports using it to set the return code: class X(Process): def run(self): if not frobulating: raise SystemExit(255) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
Ask Solem a...@opera.com added the comment: It seems that Process.terminate is not meant to be used by the child, but only the parent. From the documentation: Note that the start(), join(), is_alive() and exit_code methods should only be called by the process that created the process object. Either terminate() should be added to this list, or terminate should be patch to call sys.exit in a child process. I vote for the former, so I attached a doc patch. -- keywords: +patch Added file: http://bugs.python.org/file19466/i8028.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
5houston cadab...@gmail.com added the comment: Yes I could. You can find it attached. -- Added file: http://bugs.python.org/file19140/minCrashing.py.bz2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
Ask Solem a...@opera.com added the comment: Could you please reduce this to the shorted possible example that reproduces the problem? -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8028] self.terminate() from a multiprocessing.Process raises AttributeError exception
New submission from 5houston cadab...@gmail.com: Try to execute python -OO crashingMain.py using python 3.1 or 3.1.1. It creates and starts 5 SendingProcess(es). SendingProcess inherits from multiprocessing.Process and multiprocessing.queue.Queue. Each process starts a loop. In the meanwhile the main, calling close() method of each SendingProcess, puts 1 into each SendingProcess and each SendingProcess, when it self.get(s) it, calls self.terminate. This causes a AttributeError exception for each SendingProcess. workingMain.py instead does not call close() method. It calls directly the terminate method of each SendingProcess. -- files: pythonProcBug.tar.bz2 messages: 100191 nosy: 5houston severity: normal status: open title: self.terminate() from a multiprocessing.Process raises AttributeError exception versions: Python 3.1 Added file: http://bugs.python.org/file16390/pythonProcBug.tar.bz2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8028 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com