{"action":"created","issue":{"url":"https://api.github.com/repos/libevent/libevent/issues/175","labels_url":"https://api.github.com/repos/libevent/libevent/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/libevent/libevent/issues/175/comments","events_url":"https://api.github.com/repos/libevent/libevent/issues/175/events","html_url":"https://github.com/libevent/libevent/pull/175","id":44455909,"number":175,"title":"http: reset connection before installing retry timer (fix http retries handling)","user":{"login":"azat","id":430798,"avatar_url":"https://avatars.githubusercontent.com/u/430798?v=3","gravatar_id":"","url":"https://api.github.com/users/azat","html_url":"https://github.com/azat","followers_url":"https://api.github.com/users/azat/followers","following_url":"https://api.github.com/users/azat/following{/other_user}","gists_url":"https://api.github.com/users/azat/gists{/gist_id}","starred_url":"https://api.github.com/users/azat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azat/subscriptions","organizations_url":"https://api.github.com/users/azat/orgs","repos_url":"https://api.github.com/users/azat/repos","events_url":"https://api.github.com/users/azat/events{/privacy}","received_events_url":"https://api.github.com/users/azat/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2014-09-30T14:53:24Z","updated_at":"2015-06-22T08:59:27Z","closed_at":"2014-11-30T16:11:43Z","pull_request":{"url":"https://api.github.com/repos/libevent/libevent/pulls/175","html_url":"https://github.com/libevent/libevent/pull/175","diff_url":"https://github.com/libevent/libevent/pull/175.diff","patch_url":"https://github.com/libevent/libevent/pull/175.patch"},"body":"This will fix some invalid read/write:\r\n```\r\n==556== Invalid read of size 8\r\n==556==    at 0x4E4EEC6: event_queue_remove_timeout (minheap-internal.h:178)\r\n==556==    by 0x4E508AA: event_del_nolock_ (event.c:2764)\r\n==556==    by 0x4E53535: event_base_loop (event.c:3088)\r\n==556==    by 0x406FCFA: dispatch (libcrawl.c:271)\r\n==556==    by 0x402863: main (crawler.c:49)\r\n==556==  Address 0x68a3f18 is 152 bytes inside a block of size 400 free'd\r\n==556==    at 0x4C29C97: free (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-linux.so)\r\n==556==    by 0x406F140: renew (libcrawl.c:625)\r\n==556==    by 0x4E6CDE9: evhttp_connection_cb_cleanup (http.c:1331)\r\n==556==    by 0x4E6E2B2: evhttp_connection_cb (http.c:1424)\r\n==556==    by 0x4E4DF2D: bufferevent_writecb (bufferevent_sock.c:310)\r\n==556==    by 0x4E52D1D: event_process_active_single_queue (event.c:1584)\r\n==556==    by 0x4E53676: event_base_loop (event.c:1676)\r\n==556==    by 0x406FCFA: dispatch (libcrawl.c:271)\r\n==556==    by 0x402863: main (crawler.c:49)\r\nBut this one because of some invalid write before (I guess).\r\n```\r\n\r\nIt is 100% reproduced during massive crawling (because this process\r\nhas many different servers), but after spending some time for trying to\r\nreproduce this using some simple tests/utils I gave up for a few days (I\r\nhave a lot of work to do), but I'm sending this patch as a reminder.\r\n\r\nJust in case, I've tried next tests:\r\n- mixing timeouts/retries\r\n- shutdown http server and return it back\r\n- slow dns server for first request\r\n- sleep before accept\r\n- hacking libevent sources to change the behaviour of http layer (so it\r\n  will go into that function which I'm insterested in).\r\n\r\nAny notes/suggestions are welcome!"},"comment":{"url":"https://api.github.com/repos/libevent/libevent/issues/comments/114044949","html_url":"https://github.com/libevent/libevent/pull/175#issuecomment-114044949","issue_url":"https://api.github.com/repos/libevent/libevent/issues/175","id":114044949,"user":{"login":"azat","id":430798,"avatar_url":"https://avatars.githubusercontent.com/u/430798?v=3","gravatar_id":"","url":"https://api.github.com/users/azat","html_url":"https://github.com/azat","followers_url":"https://api.github.com/users/azat/followers","following_url":"https://api.github.com/users/azat/following{/other_user}","gists_url":"https://api.github.com/users/azat/gists{/gist_id}","starred_url":"https://api.github.com/users/azat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azat/subscriptions","organizations_url":"https://api.github.com/users/azat/orgs","repos_url":"https://api.github.com/users/azat/repos","events_url":"https://api.github.com/users/azat/events{/privacy}","received_events_url":"https://api.github.com/users/azat/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T08:59:27Z","updated_at":"2015-06-22T08:59:27Z","body":"On Sun, Jun 21, 2015 at 10:38:28PM -0700, gj12 wrote:\n> This commit causes the following problem: https://github.com/libevent/libevent/issues/258\n\nThanks! I will look into this!\n"}}