Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior for 0 or negative processes in multiprocessing.pool() #56494

Closed
jorgsk mannequin opened this issue Jun 8, 2011 · 6 comments
Closed

Unexpected behavior for 0 or negative processes in multiprocessing.pool() #56494

jorgsk mannequin opened this issue Jun 8, 2011 · 6 comments
Labels
stdlib Python modules in the Lib dir

Comments

@jorgsk
Copy link
Mannequin

jorgsk mannequin commented Jun 8, 2011

BPO 12285
Nosy @jaraco, @vstinner, @vadmium
Files
  • multitest_pool.py
  • multiprocessing_pool.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2011-06-20.15:56:45.588>
    created_at = <Date 2011-06-08.13:55:28.529>
    labels = ['library']
    title = 'Unexpected behavior for 0 or negative processes in multiprocessing.pool()'
    updated_at = <Date 2016-09-02.02:20:26.408>
    user = 'https://bugs.python.org/jorgsk'

    bugs.python.org fields:

    activity = <Date 2016-09-02.02:20:26.408>
    actor = 'jaraco'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-06-20.15:56:45.588>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2011-06-08.13:55:28.529>
    creator = 'jorgsk'
    dependencies = []
    files = ['22283', '22287']
    hgrepos = []
    issue_num = 12285
    keywords = ['patch']
    message_count = 6.0
    messages = ['137908', '137933', '138735', '274192', '274194', '274198']
    nosy_count = 5.0
    nosy_names = ['jaraco', 'vstinner', 'python-dev', 'jorgsk', 'martin.panter']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue12285'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

    @jorgsk
    Copy link
    Mannequin Author

    jorgsk mannequin commented Jun 8, 2011

    A normal way to start a multiprocessing-pool is like this:

    Multiprocessing.Pool(processes=some_number).

    However, if 'some_number' is 0 or negative, Python hangs and must be killed. I would expect an error message of the type: "Number of processes must be at least 1".

    Attaching a script that reproduces this.

    I struggled a bit with this for a program that uses cpu_count() - 4 to calculate 'some_number'. Guess what happens when the number of cores is 4 :) Even though the fix is easy (if some_number < 1), it would be nice to be warned about it.

    @jorgsk jorgsk mannequin added the stdlib Python modules in the Lib dir label Jun 8, 2011
    @vstinner
    Copy link
    Member

    vstinner commented Jun 9, 2011

    multiprocessing_pool.patch: raise a ValueError if processes is less than 1. A test should be added.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 20, 2011

    New changeset 1f171dd21bdb by Victor Stinner in branch '3.2':
    Issue bpo-12285: multiprocessing.Pool() raises a ValueError if the number of
    http://hg.python.org/cpython/rev/1f171dd21bdb

    New changeset 1861683793d9 by Victor Stinner in branch 'default':
    (merge 3.2) Issue bpo-12285: multiprocessing.Pool() raises a ValueError if the
    http://hg.python.org/cpython/rev/1861683793d9

    New changeset 815263546757 by Victor Stinner in branch '2.7':
    Issue bpo-12285: multiprocessing.Pool() raises a ValueError if the number of
    http://hg.python.org/cpython/rev/815263546757

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 2, 2016

    New changeset 941346104718 by Jason R. Coombs in branch '3.4':
    Issue bpo-12285: Add test capturing failure.
    https://hg.python.org/cpython/rev/941346104718

    New changeset 56c60b3d06fb by Jason R. Coombs in branch '3.4':
    Issue bpo-12285: Replace implementation of findall with implementation from Setuptools 7ce820d524db.
    https://hg.python.org/cpython/rev/56c60b3d06fb

    New changeset 13619a3e0737 by Jason R. Coombs in branch '3.4':
    Issue bpo-12285: Update NEWS
    https://hg.python.org/cpython/rev/13619a3e0737

    New changeset ade53661607a by Jason R. Coombs in branch '3.5':
    Issue bpo-12285: Merge with 3.4
    https://hg.python.org/cpython/rev/ade53661607a

    @vadmium
    Copy link
    Member

    vadmium commented Sep 2, 2016

    Looks like that last lot was meant to reference bpo-12885

    @jaraco
    Copy link
    Member

    jaraco commented Sep 2, 2016

    Yep. Sorry for the misfile.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants