This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: All examples for concurrent.futures fail with "BrokenProcessPool"
Type: behavior Stage:
Components: Documentation Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: docs@python Nosy List: brian.curtin, docs@python, gjwebber, pitrou, sbt, tim.golden
Priority: normal Keywords:

Created on 2013-04-09 13:04 by gjwebber, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (9)
msg186397 - (view) Author: (gjwebber) Date: 2013-04-09 13:04
Running on Windows XP 32-bit.
Uninstalled Python 2.7, installed Python 3.3.

I asked a question on stack overflow, detailing the problem and supplying example code and Traceback here:
http://stackoverflow.com/questions/15900366/all-example-concurrent-futures-code-is-failing-with-brokenprocesspool

More info on request if required.
msg186398 - (view) Author: (gjwebber) Date: 2013-04-09 13:11
Forgot to mention, the posted code works for another SO user on Debian and OS X.
msg186401 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-04-09 13:25
This is not the example code. The example code uses a main() function which is guarded by a "if" block:

if __name__ == '__main__':
    main()

See http://docs.python.org/2/library/multiprocessing.html#windows for explanations.

Also, perhaps the concurrent.futures docs could point to that paragraph.
msg186409 - (view) Author: (gjwebber) Date: 2013-04-09 13:52
As mentioned in the previously linked post, I copy-pasted the example code shown here:
http://docs.python.org/dev/library/concurrent.futures.html#processpoolexecutor-example

Which resulted in exactly the same error as the 'more simple' example I provided.

There is no mention of anything Windows specific on the documentation page, or any hints as to why this may not be working.
msg186411 - (view) Author: (gjwebber) Date: 2013-04-09 13:59
Just ran the example code linked here again for my own sanity:
http://docs.python.org/dev/library/concurrent.futures.html#processpoolexecutor-example

Exactly the same thing happened. Here is the Traceback:
Traceback (most recent call last):
  File "<string>", line 420, in run_nodebug
  File "<module1>", line 28, in <module>
  File "<module1>", line 24, in main
  File "C:\Python33\lib\concurrent\futures\_base.py", line 546, in result_iterator
    yield future.result()
  File "C:\Python33\lib\concurrent\futures\_base.py", line 399, in result
    return self.__get_result()
  File "C:\Python33\lib\concurrent\futures\_base.py", line 351, in __get_result
    raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
msg186419 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-04-09 14:57
Ok, can someone else confirm the issue on Windows?
msg186422 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2013-04-09 15:01
The example code works for me on 3.3.0 on Windows 8. I'd have to find a VM to try out XP like gjwebber - will look later.
msg186446 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2013-04-09 20:17
@gjwebber: How exactly are you running the program to get that traceback?

The following lines make it look like you are doing something non-standard (as opposed to just saving the file and running it from the command line):

  File "<string>", line 420, in run_nodebug
  File "<module1>", line 28, in <module>
  File "<module1>", line 24, in main
msg186479 - (view) Author: (gjwebber) Date: 2013-04-10 06:34
Damn, this was my screw up. It was a combination of two things that threw me off:

1. I was running my (saved) code un-gaurded, but was getting the same error as with the example code. I thought the problem was elsewhere.

2. As it was just example code, I was copy-pasting it into my IDE and running it. This caused the slightly weird looking Traceback that Richard Oudkerk pointed out and the same error message.

After saving and running the standard example, everything worked as expected. After this, I added the 'main' guard to my code and that fixed the problem there.

Sorry about that, looks like there's no problem after all. Tested at home on Win 7 and on my works machine (XP Pro).

Regards,
Gareth
History
Date User Action Args
2022-04-11 14:57:44adminsetgithub: 61874
2013-04-10 06:34:47gjwebbersetstatus: open -> closed
resolution: rejected
messages: + msg186479
2013-04-09 20:17:04sbtsetmessages: + msg186446
2013-04-09 15:01:09brian.curtinsetmessages: + msg186422
2013-04-09 14:57:55pitrousetnosy: + tim.golden, brian.curtin, sbt
messages: + msg186419
2013-04-09 13:59:45gjwebbersetmessages: + msg186411
2013-04-09 13:52:18gjwebbersetmessages: + msg186409
2013-04-09 13:25:24pitrousetassignee: docs@python
type: crash -> behavior
components: + Documentation, - Library (Lib), Windows
versions: + Python 3.4
nosy: + docs@python, pitrou

messages: + msg186401
2013-04-09 13:11:23gjwebbersetmessages: + msg186398
2013-04-09 13:04:51gjwebbercreate