{"action":"created","issue":{"url":"https://api.github.com/repos/patrickxb/stathat/issues/5","repository_url":"https://api.github.com/repos/patrickxb/stathat","labels_url":"https://api.github.com/repos/patrickxb/stathat/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/patrickxb/stathat/issues/5/comments","events_url":"https://api.github.com/repos/patrickxb/stathat/issues/5/events","html_url":"https://github.com/patrickxb/stathat/pull/5","id":13281782,"number":5,"title":"Fix StatHat::Reporter to allow #finish to avoid deadlocks waiting for worker threads","user":{"login":"bodhi","id":28731,"avatar_url":"https://avatars1.githubusercontent.com/u/28731?v=4","gravatar_id":"","url":"https://api.github.com/users/bodhi","html_url":"https://github.com/bodhi","followers_url":"https://api.github.com/users/bodhi/followers","following_url":"https://api.github.com/users/bodhi/following{/other_user}","gists_url":"https://api.github.com/users/bodhi/gists{/gist_id}","starred_url":"https://api.github.com/users/bodhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bodhi/subscriptions","organizations_url":"https://api.github.com/users/bodhi/orgs","repos_url":"https://api.github.com/users/bodhi/repos","events_url":"https://api.github.com/users/bodhi/events{/privacy}","received_events_url":"https://api.github.com/users/bodhi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2013-04-17T05:36:08Z","updated_at":"2018-03-03T01:28:57Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/patrickxb/stathat/pulls/5","html_url":"https://github.com/patrickxb/stathat/pull/5","diff_url":"https://github.com/patrickxb/stathat/pull/5.diff","patch_url":"https://github.com/patrickxb/stathat/pull/5.patch"},"body":"Worker threads would previously block waiting for content to be pushed\nonto the shared queue. So even though the thread that calls #finish marks the\nshared @running variable as false, the worker threads will never wake up to\nnotice that they should quit, thus causing a deadlock when the calling thread\n`#join`s the worker threads.\n\nAvoid this situation by pushing the process control in-band with the queued\ncontent, to signal to the worker threads that they should wake up _and_ stop\nprocessing.\n\n---\n\nThis is a minimal change to allow `#finish` to work as expected. What would probably be better is creating the threads on demand as the events are pushed into the API. This would eliminate the need for the queue and process control, at the expense of creating 1 thread per event. I haven't measured the impact of this style on GC or performance (eg. thread startup cost), but I suspect it would be negligible in the operation of a larger project.\n"},"comment":{"url":"https://api.github.com/repos/patrickxb/stathat/issues/comments/370103904","html_url":"https://github.com/patrickxb/stathat/pull/5#issuecomment-370103904","issue_url":"https://api.github.com/repos/patrickxb/stathat/issues/5","id":370103904,"user":{"login":"jjb","id":6097,"avatar_url":"https://avatars2.githubusercontent.com/u/6097?v=4","gravatar_id":"","url":"https://api.github.com/users/jjb","html_url":"https://github.com/jjb","followers_url":"https://api.github.com/users/jjb/followers","following_url":"https://api.github.com/users/jjb/following{/other_user}","gists_url":"https://api.github.com/users/jjb/gists{/gist_id}","starred_url":"https://api.github.com/users/jjb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjb/subscriptions","organizations_url":"https://api.github.com/users/jjb/orgs","repos_url":"https://api.github.com/users/jjb/repos","events_url":"https://api.github.com/users/jjb/events{/privacy}","received_events_url":"https://api.github.com/users/jjb/received_events","type":"User","site_admin":false},"created_at":"2018-03-03T01:28:57Z","updated_at":"2018-03-03T01:28:57Z","author_association":"NONE","body":"I think I've now solved this in a better way here https://github.com/patrickxb/stathat/pull/10\r\n\r\nin this commit: https://github.com/patrickxb/stathat/pull/10/commits/b47dd80503a059225d8f9eca9c8d1f97bb7c9827"}}
{"actor":{"display_login":"jjb"}}