{"action":"created","issue":{"url":"https://api.github.com/repos/sustrik/libmill/issues/132","repository_url":"https://api.github.com/repos/sustrik/libmill","labels_url":"https://api.github.com/repos/sustrik/libmill/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/sustrik/libmill/issues/132/comments","events_url":"https://api.github.com/repos/sustrik/libmill/issues/132/events","html_url":"https://github.com/sustrik/libmill/issues/132","id":135631459,"number":132,"title":"panic: multiple coroutines waiting for a single file descriptor","user":{"login":"benjolitz","id":270476,"avatar_url":"https://avatars.githubusercontent.com/u/270476?v=3","gravatar_id":"","url":"https://api.github.com/users/benjolitz","html_url":"https://github.com/benjolitz","followers_url":"https://api.github.com/users/benjolitz/followers","following_url":"https://api.github.com/users/benjolitz/following{/other_user}","gists_url":"https://api.github.com/users/benjolitz/gists{/gist_id}","starred_url":"https://api.github.com/users/benjolitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjolitz/subscriptions","organizations_url":"https://api.github.com/users/benjolitz/orgs","repos_url":"https://api.github.com/users/benjolitz/repos","events_url":"https://api.github.com/users/benjolitz/events{/privacy}","received_events_url":"https://api.github.com/users/benjolitz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":38,"created_at":"2016-02-23T04:40:54Z","updated_at":"2016-02-27T18:23:26Z","closed_at":null,"body":"I have a prototype project at https://github.com/benjolitz/blaster\r\n\r\nIn the most recent commit, I've rewritten my approach to be more clean.\r\n\r\nAfter ~100 hits from apache bench on OSX, I get a ```panic: multiple coroutines waiting for a single file descriptor```\r\n\r\nHere is a console session:\r\n```\r\n(cpython27) benjolitz-laptop:~/software/blaster [master]$ make clean debug ; lldb ./blaster -- 8051\r\nDeleting blaster symlink\r\nDeleting directories\r\nCreating directories\r\nBeginning debug build\r\nCompiling: src//blaster.c -> build/debug//blaster.o\r\n\t Compile time: 0\r\nCompiling: src//contrib/http_parser.c -> build/debug//contrib/http_parser.o\r\n\t Compile time: 0\r\nLinking: bin/debug/blaster\r\n\t Link time: 0\r\nMaking symlink: blaster -> bin/debug/blaster\r\nTotal build time: 0\r\n(lldb) target create \"./blaster\"\r\nCurrent executable set to './blaster' (x86_64).\r\n(lldb) settings set -- target.run-args  \"8051\"\r\n(lldb) run\r\nProcess 81146 launched: './blaster' (x86_64)\r\nStarting 1 process(es)\r\nListening on port 8051\r\npanic: multiple coroutines waiting for a single file descriptor\r\nProcess 81146 stopped\r\n* thread #1: tid = 0x99b7c4, 0x00007fff8bd0b002 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT\r\n    frame #0: 0x00007fff8bd0b002 libsystem_kernel.dylib`__pthread_kill + 10\r\nlibsystem_kernel.dylib`__pthread_kill:\r\n->  0x7fff8bd0b002 <+10>: jae    0x7fff8bd0b00c            ; <+20>\r\n    0x7fff8bd0b004 <+12>: movq   %rax, %rdi\r\n    0x7fff8bd0b007 <+15>: jmp    0x7fff8bd05bdd            ; cerror_nocancel\r\n    0x7fff8bd0b00c <+20>: retq\r\n(lldb) bt\r\n* thread #1: tid = 0x99b7c4, 0x00007fff8bd0b002 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT\r\n  * frame #0: 0x00007fff8bd0b002 libsystem_kernel.dylib`__pthread_kill + 10\r\n    frame #1: 0x00007fff93eb35c5 libsystem_pthread.dylib`pthread_kill + 90\r\n    frame #2: 0x00007fff8a2316e7 libsystem_c.dylib`abort + 129\r\n    frame #3: 0x0000000100010737 libmill.15.dylib`mill_panic + 39\r\n    frame #4: 0x0000000100011cbc libmill.15.dylib`mill_fdwait + 137\r\n    frame #5: 0x0000000100012d20 libmill.15.dylib`tcpaccept + 144\r\n    frame #6: 0x000000010000181f blaster`main(arg_count=2, args=0x00007fff5fbff830) + 511 at blaster.c:182\r\n    frame #7: 0x00007fff91bc65ad libdyld.dylib`start + 1\r\n(lldb)\r\n```\r\n\r\nAfter inspecting `tcp.c`, I cannot find where calling tcpclose() deregisters the connection explicitly.\r\n\r\nAlso, I cannot figure out how to pass a tcpsock into a new coroutine for handling HTTP/1.1 connections cleanly."},"comment":{"url":"https://api.github.com/repos/sustrik/libmill/issues/comments/189698943","html_url":"https://github.com/sustrik/libmill/issues/132#issuecomment-189698943","issue_url":"https://api.github.com/repos/sustrik/libmill/issues/132","id":189698943,"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":"2016-02-27T18:23:26Z","updated_at":"2016-02-27T18:23:26Z","body":"Accessing guard page should give SIGSEGV. Even list_item should matter, given that second-to-last cached stack would now point to invalid item."}}