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

multiprocessing pool + subprocess ValueError: empty range for randrange #80759

Closed
ghost opened this issue Apr 9, 2019 · 3 comments
Closed

multiprocessing pool + subprocess ValueError: empty range for randrange #80759

ghost opened this issue Apr 9, 2019 · 3 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ghost
Copy link

ghost commented Apr 9, 2019

BPO 36578
Files
  • demo.py
  • 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 2019-04-09.16:11:03.423>
    created_at = <Date 2019-04-09.15:54:39.732>
    labels = ['invalid', 'type-bug', 'library']
    title = 'multiprocessing pool + subprocess ValueError: empty range for randrange'
    updated_at = <Date 2019-04-09.16:11:03.418>
    user = None

    bugs.python.org fields:

    activity = <Date 2019-04-09.16:11:03.418>
    actor = 'SilentGhost'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-04-09.16:11:03.423>
    closer = 'SilentGhost'
    components = ['Library (Lib)']
    creation = <Date 2019-04-09.15:54:39.732>
    creator = '\xe5\xad\x91\xe5\xbd\xb1'
    dependencies = []
    files = ['48256']
    hgrepos = []
    issue_num = 36578
    keywords = []
    message_count = 3.0
    messages = ['339767', '339769', '339770']
    nosy_count = 2.0
    nosy_names = ['SilentGhost', '\xe5\xad\x91\xe5\xbd\xb1']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36578'
    versions = ['Python 3.6']

    @ghost
    Copy link
    Author

    ghost commented Apr 9, 2019

    == output ==
    python2 /tmp/demo.py 
    31749 task#1 result:(False, 'ls: cannot access alksdfjalkdsfadsfk: No such file or directoryn') 
    31751 task#2 result:(False, 'ls: cannot access alksdfjalkdsfadsfk: No such file or directoryn') 
    31752 task#3 result:(False, '3n') 
    31750 task#4 result:(False, '4n') 
    31749 task#6 result:(False, '6n') 
    31752 task#7 result:(False, '7n') 
    31750 task#8 result:(False, '8n') 
    31751 task#9 result:(False, '9n') 
    Traceback (most recent call last):
      File "/tmp/demo.py", line 74, in <module>
        runner()
      File "/tmp/demo.py", line 64, in runner
        rc_orig = value.get()
      File "/usr/lib64/python2.7/multiprocessing/pool.py", line 554, in get
        raise self._value
    ValueError: empty range for randrange() (1,1, 0)

    == The python2.7 demo ==
    http://paste.ubuntu.org.cn/4379593

    == More ==
    The interesting thing is if you modify demo.py like this .

    http://paste.ubuntu.org.cn/4379595

    Almost the code can be run normal.

    Repository owner added the stdlib Python modules in the Lib dir label Apr 9, 2019
    @ghost
    Copy link
    Author

    ghost commented Apr 9, 2019

    My python version info:

    Python 2.7.13 (default, Sep 26 2018, 18:42:22)
    [GCC 6.3.0 20170516] on linux2

    Python 3.5.3 (default, Sep 27 2018, 17:25:39)
    [GCC 6.3.0 20170516] on linux

    @SilentGhost
    Copy link
    Mannequin

    SilentGhost mannequin commented Apr 9, 2019

    The error you're seeing stems from this bit of code:

    random.randint(1, 0)

    With zero resulting from taskid % 5 operation for values of taskid divisible by 5. Obviously, when you comment out this line you're not seeing the error.

    @SilentGhost SilentGhost mannequin closed this as completed Apr 9, 2019
    @SilentGhost SilentGhost mannequin added invalid type-bug An unexpected behavior, bug, or error labels Apr 9, 2019
    @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 type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant