benoitc / benoitc/offset

Segmentation fault with many go routines

Open
#13 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
380
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Running this program.

``` python
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. :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.