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.
Created on 2009年07月07日 11:39 by ede, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| map_testandfix.patch | ede, 2009年07月07日 11:39 | a patch including the testcase and the fix | ||
| Messages (6) | |||
|---|---|---|---|
| msg90228 - (view) | Author: Eric Eisner (ede) | Date: 2009年07月07日 11:39 | |
In multiprocessing, if you give a pool.map a zero-length iterator and specify a nonzero chunksize, the process hangs indefinitely. Example: import multiprocessing pool = multiprocessing.Pool() pool.map(len, [], chunksize=1) # hang forever Attached simple testcase and simple fix. I observed this behavior on 2.6 and 3.1, but only verified the patch on 3.1. Unless the line numbers changed it will probably fix it on 2.6 as well. |
|||
| msg90231 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2009年07月07日 12:06 | |
I'm not familiar with multiprocessing but I gave a quick look at the patch. If the 'iterable' is an iterator/generator "if len(iterable) == 0:" may fail since these objects don't usually have a __len__. More tests for this situation are probably needed too. |
|||
| msg90232 - (view) | Author: Eric Eisner (ede) | Date: 2009年07月07日 12:19 | |
A few lines before this patch the code turns iterable into a list if it
does not hasattr('__len__') for the purpose of calculating the chunksize.
|
|||
| msg90483 - (view) | Author: Eric Eisner (ede) | Date: 2009年07月13日 14:08 | |
Can anyone review this patch? It is a very simple fix to catch this one edge case. As this can cause multiprocessing to enter a state where it needs to be externally killed, it would be good if this made 2.6.3. |
|||
| msg90484 - (view) | Author: Jesse Noller (jnoller) * (Python committer) | Date: 2009年07月13日 14:25 | |
It's on my list for this week. |
|||
| msg90571 - (view) | Author: Jesse Noller (jnoller) * (Python committer) | Date: 2009年07月16日 14:23 | |
committed r74023 on trunk |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:50 | admin | set | github: 50682 |
| 2009年07月16日 14:23:46 | jnoller | set | status: open -> closed resolution: fixed |
| 2009年07月16日 14:23:35 | jnoller | set | messages: + msg90571 |
| 2009年07月13日 14:25:24 | jnoller | set | messages: + msg90484 |
| 2009年07月13日 14:08:30 | ede | set | messages: + msg90483 |
| 2009年07月07日 13:13:14 | jnoller | set | assignee: jnoller |
| 2009年07月07日 13:11:48 | r.david.murray | set | nosy:
+ jnoller |
| 2009年07月07日 12:19:15 | ede | set | messages: + msg90232 |
| 2009年07月07日 12:06:00 | ezio.melotti | set | priority: normal versions: + Python 3.2, - Python 2.6 nosy: + ezio.melotti messages: + msg90231 type: crash -> behavior |
| 2009年07月07日 11:39:03 | ede | create | |