{"action":"created","issue":{"url":"https://api.github.com/repos/sustrik/libdill/issues/66","repository_url":"https://api.github.com/repos/sustrik/libdill","labels_url":"https://api.github.com/repos/sustrik/libdill/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/sustrik/libdill/issues/66/comments","events_url":"https://api.github.com/repos/sustrik/libdill/issues/66/events","html_url":"https://github.com/sustrik/libdill/issues/66","id":197457335,"number":66,"title":"[Bug] hdup SEGFAULTs after the 255th duplication of the same handle","user":{"login":"genericname462","id":7455710,"avatar_url":"https://avatars.githubusercontent.com/u/7455710?v=3","gravatar_id":"","url":"https://api.github.com/users/genericname462","html_url":"https://github.com/genericname462","followers_url":"https://api.github.com/users/genericname462/followers","following_url":"https://api.github.com/users/genericname462/following{/other_user}","gists_url":"https://api.github.com/users/genericname462/gists{/gist_id}","starred_url":"https://api.github.com/users/genericname462/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genericname462/subscriptions","organizations_url":"https://api.github.com/users/genericname462/orgs","repos_url":"https://api.github.com/users/genericname462/repos","events_url":"https://api.github.com/users/genericname462/events{/privacy}","received_events_url":"https://api.github.com/users/genericname462/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-24T10:14:11Z","updated_at":"2016-12-24T11:20:20Z","closed_at":null,"body":"The error originally occurred while handling TCP connections with dsock, but can be reduced to the following snippet:\r\n\r\n```\r\nvoid dup_test() {\r\n    uint64_t count = 0;\r\n    uint64_t runs = 1024;\r\n\r\n    int ch = chmake(1);\r\n    assert(ch >= 0);\r\n\r\n    while (count < runs) {\r\n        printf(\"\\r%lu\", count); fflush(stdout);\r\n        int h = hdup(ch);\r\n        assert(h >= 0);\r\n        ++count;\r\n        h = hclose(h);\r\n        assert(h >= 0);\r\n    }\r\n}\r\n```\r\n\r\nOutput with ASAN enabled:\r\n```\r\n255ASAN:SIGSEGV\r\n=================================================================\r\n==12351==ERROR: AddressSanitizer: SEGV on unknown address 0x607017000011 (pc 0x0000004054b3 bp 0x7ffe03ca6580 sp 0x7ffe03ca6550 T0)\r\n    #0 0x4054b2 in hdup [...]/libdill/handle.c:107\r\n    #1 0x402ef2 in dup_test [...]/foo.c:142\r\n    #2 0x4022ca in main [...]/foo.c:151\r\n    #3 0x7f5b3f8ae82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)\r\n    #4 0x402318 in _start ([...]/seg+0x402318)\r\n\r\nAddressSanitizer can not provide additional info.\r\nSUMMARY: AddressSanitizer: SEGV [...]/libdill/handle.c:107 hdup\r\n==12351==ABORTING\r\n\r\nProcess finished with exit code 1\r\n```\r\n\r\n\r\nLibrary compiled with ```./configure --disable-shared --enable-debug```\r\n"},"comment":{"url":"https://api.github.com/repos/sustrik/libdill/issues/comments/269080433","html_url":"https://github.com/sustrik/libdill/issues/66#issuecomment-269080433","issue_url":"https://api.github.com/repos/sustrik/libdill/issues/66","id":269080433,"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-12-24T11:20:20Z","updated_at":"2016-12-24T11:20:20Z","body":"Fixed in the mainline. Please, re-check."}}
{"actor":{"display_login":"sustrik"}}