Skip to content

Segmentation fault with many go routines #13

Open

Description

@graffic

Running this program.

from offset import maintask, run, go, makechan

def gopher(left, right):
    value = right.recv()
    left.send(value + 1)

def starter(chan):
    chan.send(1)

@maintask
def main():
    leftmost = makechan()
    right = leftmost
    left = leftmost
    for _ in range(10000):
        right = makechan()
        go(gopher, left, right)
        left = right
    go(starter, right)
    print(leftmost.recv())

if __name__ == "__main__":
    run()

I get:

$ python gophers.offset.py
zsh: segmentation fault  python gophers.offset.py

The output I expected was 10001.

Tested with

  • Interpreters
    • Python 2.7.3 (87aa9de10f9ca71da9ab4a3d53e0ba176b67d086, Feb 03 2014, 13:03:18)[PyPy 2.2.1]
    • Python 3.3.3 (default, Dec 22 2013, 19:33:55)
  • offset library from github
  • fibers 0.3.0

I don't know if this is caused by the offset library, fibers library or any other combination so I decided to start from here. :)

Activity

  1. benoitc commented on Feb 9, 2014

    @benoitc
    Owner

    I reproduced it with python 3.4 as well. Reducing the number in the range make the problem disappear so I suspect a race condition.

    I am about to replace the channels with an improved version, i will have a a look on that at the same time. Thanks for the test!

  2. benoitc commented on May 17, 2014

    @benoitc
    Owner

    it will be fixed with the new scheduler.

  3. added this to the version 1 milestone on May 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions