[New-bugs-announce] [issue27081] Multiprocessing is not robust against sys.stderr changes

ppperry report at bugs.python.org
Sat May 21 17:04:33 EDT 2016


New submission from ppperry:

In this code, one would expect that the entire traceback from the uncaught recursion error would get put onto the queue, where it could be read in the main process.
  queue = multiprocessing.Queue()
  def do_stderr(queue):
   	class f:
		def write(self, data):
			queue.put(data)
		def flush(self):
			pass
	import sys
	sys.stderr = f()
	def g():
		g()
	g()
    multiprocessing.Process(target=do_stderr,args=(queue,)).start()

However, only some of the output actually gets enqueued:

 Process IdleProcess-6:
 Traceback (most recent call last):
 File "C:\Python34\lib\multiprocessing\process.py", line 254, in _bootstrap
    self.run()
  File "C:\Python34\lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "<pyshell#446>", line 12, in do_stderr
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g
  File "<pyshell#446>", line 11, in g

The rest of the data is not accessible.

----------
components: Library (Lib)
messages: 266026
nosy: ppperry
priority: normal
severity: normal
status: open
title: Multiprocessing is not robust against sys.stderr changes
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27081>
_______________________________________


More information about the New-bugs-announce mailing list