{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6990","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6990/labels{/name}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6990/comments","events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6990/events","html_url":"https://github.com/bitcoin/bitcoin/pull/6990","id":116379574,"number":6990,"title":"http: speed up shutdown","user":{"login":"laanwj","id":126646,"avatar_url":"https://avatars.githubusercontent.com/u/126646?v=3","gravatar_id":"","url":"https://api.github.com/users/laanwj","html_url":"https://github.com/laanwj","followers_url":"https://api.github.com/users/laanwj/followers","following_url":"https://api.github.com/users/laanwj/following{/other_user}","gists_url":"https://api.github.com/users/laanwj/gists{/gist_id}","starred_url":"https://api.github.com/users/laanwj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laanwj/subscriptions","organizations_url":"https://api.github.com/users/laanwj/orgs","repos_url":"https://api.github.com/users/laanwj/repos","events_url":"https://api.github.com/users/laanwj/events{/privacy}","received_events_url":"https://api.github.com/users/laanwj/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bitcoin/bitcoin/labels/RPC","name":"RPC","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-11T17:12:13Z","updated_at":"2015-11-12T07:46:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6990","html_url":"https://github.com/bitcoin/bitcoin/pull/6990","diff_url":"https://github.com/bitcoin/bitcoin/pull/6990.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/6990.patch"},"body":"Pardon a bit of iteration. This continues/fixes #6719.\r\n\r\n`event_base_loopexit` was not doing what I expected it to. What I expected was that it sets a timeout, given that no other pending events it would exit in N seconds. However, what it does was delay the event loop exit with N seconds, even if nothing is pending.\r\n\r\nSolve it in a different way: give the event loop thread time to exit out of itself, and if it doesn't, send loopbreak (and then join it).\r\n\r\nThis speeds up the RPC tests a lot, each exit incurred a 10 second overhead, with this change there should be no shutdown overhead in the common case and up to two seconds if the event loop is blocking.\r\n\r\nAs a bonus this breaks dependency on the global boost::thread_group, as the HTTP server minds its own offspring.\r\n\r\nTime for rpctests with this patch:\r\n```\r\nreal    7m50.215s\r\nuser    0m30.152s\r\nsys     0m11.752s\r\n```\r\nWithout:\r\n```\r\nreal    13m12.069s\r\nuser    0m30.412s\r\nsys     0m11.168s\r\n```"},"comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments/156026958","html_url":"https://github.com/bitcoin/bitcoin/pull/6990#issuecomment-156026958","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6990","id":156026958,"user":{"login":"jonasschnelli","id":178464,"avatar_url":"https://avatars.githubusercontent.com/u/178464?v=3","gravatar_id":"","url":"https://api.github.com/users/jonasschnelli","html_url":"https://github.com/jonasschnelli","followers_url":"https://api.github.com/users/jonasschnelli/followers","following_url":"https://api.github.com/users/jonasschnelli/following{/other_user}","gists_url":"https://api.github.com/users/jonasschnelli/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasschnelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasschnelli/subscriptions","organizations_url":"https://api.github.com/users/jonasschnelli/orgs","repos_url":"https://api.github.com/users/jonasschnelli/repos","events_url":"https://api.github.com/users/jonasschnelli/events{/privacy}","received_events_url":"https://api.github.com/users/jonasschnelli/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T07:46:07Z","updated_at":"2015-11-12T07:46:07Z","body":"utACK."}}