{"action":"created","issue":{"url":"https://api.github.com/repos/sustrik/libmill/issues/62","labels_url":"https://api.github.com/repos/sustrik/libmill/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/sustrik/libmill/issues/62/comments","events_url":"https://api.github.com/repos/sustrik/libmill/issues/62/events","html_url":"https://github.com/sustrik/libmill/issues/62","id":98049554,"number":62,"title":"global hang up","user":{"login":"nirs","id":395026,"avatar_url":"https://avatars.githubusercontent.com/u/395026?v=3","gravatar_id":"","url":"https://api.github.com/users/nirs","html_url":"https://github.com/nirs","followers_url":"https://api.github.com/users/nirs/followers","following_url":"https://api.github.com/users/nirs/following{/other_user}","gists_url":"https://api.github.com/users/nirs/gists{/gist_id}","starred_url":"https://api.github.com/users/nirs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nirs/subscriptions","organizations_url":"https://api.github.com/users/nirs/orgs","repos_url":"https://api.github.com/users/nirs/repos","events_url":"https://api.github.com/users/nirs/events{/privacy}","received_events_url":"https://api.github.com/users/nirs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-29T23:21:09Z","updated_at":"2015-07-30T05:35:56Z","closed_at":null,"body":"Runing this script simulating concurrent using turorial/step6 in expected way:\r\n\r\n```\r\nimport socket\r\nimport time\r\n\r\ndef connect():\r\n    s = socket.socket()\r\n    s.connect((\"127.0.0.1\", 5555))\r\n    return s\r\n\r\nwhile 1:\r\n    connections = [connect() for _ in range(10)]                                                                                                                                \r\n    for s in connections:\r\n        s.recv(100)\r\n    for s in connections:\r\n        s.sendall(\"Name\\r\\n\")\r\n    for s in connections:\r\n        s.recv(100)\r\n    for s in connections:\r\n        s.close()\r\n```\r\n\r\ntutorial/step6 hang up after 20 connections, when the last connection is closed.\r\n\r\n```\r\n$ tutorial/step6\r\nTotal number of connections: 1\r\nActive connections: 1\r\nFailed connections: 0\r\n\r\nTotal number of connections: 2\r\nActive connections: 2\r\nFailed connections: 0\r\n\r\nTotal number of connections: 3\r\nActive connections: 3\r\nFailed connections: 0\r\n\r\nTotal number of connections: 4\r\nActive connections: 4\r\nFailed connections: 0\r\n\r\nTotal number of connections: 5\r\nActive connections: 5\r\nFailed connections: 0\r\n\r\nTotal number of connections: 6\r\nActive connections: 6\r\nFailed connections: 0\r\n\r\nTotal number of connections: 7\r\nActive connections: 7\r\nFailed connections: 0\r\n\r\nTotal number of connections: 8\r\nActive connections: 8\r\nFailed connections: 0\r\n\r\nTotal number of connections: 9\r\nActive connections: 9\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 10\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 9\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 8\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 7\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 6\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 5\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 4\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 3\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 2\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 1\r\nFailed connections: 0\r\n\r\nTotal number of connections: 10\r\nActive connections: 0\r\nFailed connections: 0\r\n\r\nTotal number of connections: 11\r\nActive connections: 1\r\nFailed connections: 0\r\n\r\nTotal number of connections: 12\r\nActive connections: 2\r\nFailed connections: 0\r\n\r\nTotal number of connections: 13\r\nActive connections: 3\r\nFailed connections: 0\r\n\r\nTotal number of connections: 14\r\nActive connections: 4\r\nFailed connections: 0\r\n\r\nTotal number of connections: 15\r\nActive connections: 5\r\nFailed connections: 0\r\n\r\nTotal number of connections: 16\r\nActive connections: 6\r\nFailed connections: 0\r\n\r\nTotal number of connections: 17\r\nActive connections: 7\r\nFailed connections: 0\r\n\r\nTotal number of connections: 18\r\nActive connections: 8\r\nFailed connections: 0\r\n\r\nTotal number of connections: 19\r\nActive connections: 9\r\nFailed connections: 0\r\n\r\npanic: global hang-up\r\n```\r\n\r\nI replaced the mill_panic() with mill_assert() so we can inspect the process state when it panics:\r\n\r\n```\r\nTotal number of connections: 114\r\nActive connections: 4\r\nFailed connections: 0\r\n\r\nTotal number of connections: 115\r\nActive connections: 5\r\nFailed connections: 0\r\n\r\nTotal number of connections: 116\r\nActive connections: 6\r\nFailed connections: 0\r\n\r\nTotal number of connections: 117\r\nActive connections: 7\r\nFailed connections: 0\r\n\r\nTotal number of connections: 118\r\nActive connections: 8\r\nFailed connections: 0\r\n\r\nTotal number of connections: 119\r\nActive connections: 9\r\nFailed connections: 0\r\n\r\nAssert failed: 0 (poller.c:160)\r\n\r\nProgram received signal SIGABRT, Aborted.\r\n0x000000305fa35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56\r\n56\t  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);\r\n(gdb) p goredump()\r\n\r\nCOROUTINE  state                                      current                                  created\r\n------------------------------------------------------------------------------------------------------------------------\r\n{0}        fdwait(-1)                                 tcp.c:178                                <main>\r\n{1}        ready                                      tutorial/step6.c:41                      tutorial/step6.c:105\r\n{112}      chs(<1>)                                   tutorial/step6.c:86                      tutorial/step6.c:111\r\n{113}      chs(<1>)                                   tutorial/step6.c:86                      tutorial/step6.c:111\r\n{114}      chs(<1>)                                   tutorial/step6.c:86                      tutorial/step6.c:111\r\n{115}      chs(<1>)                                   tutorial/step6.c:86                      tutorial/step6.c:111\r\n{116}      chs(<1>)                                   tutorial/step6.c:86                      tutorial/step6.c:111\r\n{117}      chs(<1>)                                   tutorial/step6.c:86                      tutorial/step6.c:111\r\n{118}      chs(<1>)                                   tutorial/step6.c:86                      tutorial/step6.c:111\r\n{119}      chs(<1>)                                   tutorial/step6.c:86                      tutorial/step6.c:111\r\n{120}      chs(<1>)                                   tutorial/step6.c:86                      tutorial/step6.c:111\r\n{121}      chs(<1>)                                   ---                                      tutorial/step6.c:111\r\n\r\nCHANNEL  msgs/max    senders/receivers                          refs  done  created\r\n------------------------------------------------------------------------------------------------------------------------\r\n<1>      0/0         s:{112},{113},{114},{115},{116},{117},{118},{119},{120},{121} 1     no    tutorial/step6.c:104\r\n\r\n$1 = void\r\n(gdb) p *mill_running\r\n$2 = {state = MILL_CHS, u_ready = {item = {next = 0x0}}, u_fdwait = {item = {next = 0x0, prev = 0x0}, expiry = 128496030}, u_choose = {clauses = {first = 0x7ffff7e4bab0, \r\n      last = 0x7ffff7e4bab0}, othws = 0, available = 0}, ctx = {jbuf = {{__jmpbuf = {140737488346752, 6321267569117360643, 4198560, 140737488347248, 0, 0, \r\n          6321267569111069187, -6321285767971081725}, __mask_was_saved = 0, __saved_mask = {__val = {0 <repeats 16 times>}}}}}, valbuf = {ptr = 0x0, capacity = 128, \r\n    buf = '\\000' <repeats 127 times>}, result = 1, cls = 0x0, debug = {item = {next = 0x0, prev = 0x7ffff7d8bee8}, id = 121, created = 0x40573c \"tutorial/step6.c:111\", \r\n    current = 0x4056ce \"tutorial/step6.c:86\"}}\r\n```"},"comment":{"url":"https://api.github.com/repos/sustrik/libmill/issues/comments/126190793","html_url":"https://github.com/sustrik/libmill/issues/62#issuecomment-126190793","issue_url":"https://api.github.com/repos/sustrik/libmill/issues/62","id":126190793,"user":{"login":"sustrik","id":305718,"avatar_url":"https://avatars.githubusercontent.com/u/305718?v=3","gravatar_id":"","url":"https://api.github.com/users/sustrik","html_url":"https://github.com/sustrik","followers_url":"https://api.github.com/users/sustrik/followers","following_url":"https://api.github.com/users/sustrik/following{/other_user}","gists_url":"https://api.github.com/users/sustrik/gists{/gist_id}","starred_url":"https://api.github.com/users/sustrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sustrik/subscriptions","organizations_url":"https://api.github.com/users/sustrik/orgs","repos_url":"https://api.github.com/users/sustrik/repos","events_url":"https://api.github.com/users/sustrik/events{/privacy}","received_events_url":"https://api.github.com/users/sustrik/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T05:35:56Z","updated_at":"2015-07-30T05:35:56Z","body":"Fixed. Plase re-check and confirm."}}