{"action":"opened","issue":{"url":"https://api.github.com/repos/sustrik/libmill/issues/61","labels_url":"https://api.github.com/repos/sustrik/libmill/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/sustrik/libmill/issues/61/comments","events_url":"https://api.github.com/repos/sustrik/libmill/issues/61/events","html_url":"https://github.com/sustrik/libmill/issues/61","id":98043885,"number":61,"title":"Segfault when client disconnect in fdwait","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":0,"created_at":"2015-07-29T22:35:10Z","updated_at":"2015-07-29T22:35:10Z","closed_at":null,"body":"Running this Python script on debug build against tutorial/step6, running in gdb.\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.close()\r\n```\r\n\r\n```\r\n==> 01:28:43.240256 {1}      chr(<1>) at tutorial/step6.c:41\r\n==> 01:28:43.240271 {11}     chs(<1>) at tutorial/step6.c:88\r\n==> 01:28:43.240283 {10}     chs(<1>) at tutorial/step6.c:88\r\n==> 01:28:43.240293 {9}      chs(<1>) at tutorial/step6.c:88\r\n==> 01:28:43.240304 {8}      chs(<1>) at tutorial/step6.c:88\r\n==> 01:28:43.240314 {7}      chs(<1>) at tutorial/step6.c:88\r\nTotal number of connections: 10\r\nActive connections: 4\r\nFailed connections: 6\r\n\r\n==> 01:28:43.240328 {1}      chr(<1>) at tutorial/step6.c:41\r\n==> 01:28:43.240376 {11}     go() done\r\n==> 01:28:43.240397 {10}     go() done\r\nTotal number of connections: 10\r\nActive connections: 3\r\nFailed connections: 7\r\n\r\n==> 01:28:43.240406 {1}      chr(<1>) at tutorial/step6.c:41\r\n==> 01:28:43.240425 {9}      go() done\r\nTotal number of connections: 10\r\nActive connections: 2\r\nFailed connections: 8\r\n\r\n==> 01:28:43.240459 {1}      chr(<1>) at tutorial/step6.c:41\r\n==> 01:28:43.240499 {8}      go() done\r\nTotal number of connections: 10\r\nActive connections: 1\r\nFailed connections: 9\r\n\r\n==> 01:28:43.240516 {1}      chr(<1>) at tutorial/step6.c:41\r\n==> 01:28:43.240555 {7}      go() done\r\nTotal number of connections: 10\r\nActive connections: 0\r\nFailed connections: 10\r\n\r\n==> 01:28:43.240574 {1}      chr(<1>) at tutorial/step6.c:41\r\n\r\nProgram received signal SIGSEGV, Segmentation fault.\r\n0x0000000000000000 in ?? ()\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}        chr(<1>)                                   tutorial/step6.c:41                      tutorial/step6.c:105\r\n\r\nCHANNEL  msgs/max    senders/receivers                          refs  done  created\r\n------------------------------------------------------------------------------------------------------------------------\r\n<1>      0/0         r:{1}                                      1     no    tutorial/step6.c:104\r\n\r\n$1 = void\r\n(gdb) list\r\n84\t    cleanup:\r\n85\t    if(errno == 0)\r\n86\t        chs(ch, int, CONN_SUCCEEDED);\r\n87\t    else\r\n88\t        chs(ch, int, CONN_FAILED);\r\n89\t    tcpclose(as);\r\n90\t}\r\n91\t\r\n92\tint main(int argc, char *argv[]) {\r\n93\t    gotrace(1);\r\n(gdb) bt\r\n#0  0x0000000000000000 in ?? ()\r\n#1  0x00007ffff7e4bd20 in ?? ()\r\n#2  0x000000305fa51a47 in __fprintf (stream=<optimized out>, format=<optimized out>) at fprintf.c:32\r\n#3  0x0000000000403114 in mill_trace_ (location=<error reading variable: Cannot access memory at address 0xfffffffffffffe08>, \r\n    format=<error reading variable: Cannot access memory at address 0xfffffffffffffe00>) at debug.c:225\r\nBacktrace stopped: previous frame inner to this frame (corrupt stack?)\r\n```"}}