classification
Title: multiprocessing.dummy: pool.map hangs on empty list
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: davin, jnoller, sbt, tomer70
Priority: normal Keywords:

Created on 2015-11-18 14:04 by tomer70, last changed 2015-11-21 20:26 by davin. This issue is now closed.

Messages (4)
msg254844 - (view) Author: Tomer (tomer70) Date: 2015-11-18 14:04
Hi,
In multiprocessing.dummy module I noticed when you send a zero-length iterator to pool.map it hang forever,

Code example:

import urllib2 
from multiprocessing.dummy import Pool as ThreadPool

def start_multithreading_urlopen(threads_num):

    pool = ThreadPool(threads_num)
    results = pool.map(urllib2.urlopen, [])
    pool.close() 
    pool.join()

    # hang here

    print results

I think it related to Issue6433 that was fixed on multiprocessing module with simple length check
msg254973 - (view) Author: Davin Potts (davin) * (Python committer) Date: 2015-11-20 13:05
I am unable to reproduce the behavior you describe using the code you provided.  I've tried on both the current Linux Mint release (64-bit) and OS X 10.10 using the current Python 2.7 release (2.7.10).

Could you be more specific about what platform you are using and the precise (2.7.?) version of Python?  Anything else that might be missing from your example to help us reproduce?
msg255062 - (view) Author: Tomer (tomer70) Date: 2015-11-21 16:50
Thanks for the reply,

So first thing I found that I wasn’t working with python 2.7.10 – I updated to 2.7.10 and it fixed the problem.

If you are still curious about reproducing the behavior I’m working on windows 7 64 bit and as I said I worked with python 2.7,

Thank you.
msg255070 - (view) Author: Davin Potts (davin) * (Python committer) Date: 2015-11-21 20:26
@tomer70: Thanks for the update and glad to hear that updating to the latest release fixed the issue.
History
Date User Action Args
2015-11-21 20:26:57davinsetmessages: + msg255070
2015-11-21 16:52:15abarrysetstatus: open -> closed
resolution: not a bug
2015-11-21 16:50:05tomer70setmessages: + msg255062
2015-11-20 13:05:51davinsetnosy: + davin
messages: + msg254973
2015-11-19 21:38:08tomer70setnosy: + jnoller, sbt
2015-11-18 14:04:58tomer70create