{"action":"created","issue":{"url":"https://api.github.com/repos/libuv/libuv/issues/291","labels_url":"https://api.github.com/repos/libuv/libuv/issues/291/labels{/name}","comments_url":"https://api.github.com/repos/libuv/libuv/issues/291/comments","events_url":"https://api.github.com/repos/libuv/libuv/issues/291/events","html_url":"https://github.com/libuv/libuv/pull/291","id":64580173,"number":291,"title":"misc: expose handle print APIs","user":{"login":"petkaantonov","id":829734,"avatar_url":"https://avatars.githubusercontent.com/u/829734?v=3","gravatar_id":"","url":"https://api.github.com/users/petkaantonov","html_url":"https://github.com/petkaantonov","followers_url":"https://api.github.com/users/petkaantonov/followers","following_url":"https://api.github.com/users/petkaantonov/following{/other_user}","gists_url":"https://api.github.com/users/petkaantonov/gists{/gist_id}","starred_url":"https://api.github.com/users/petkaantonov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petkaantonov/subscriptions","organizations_url":"https://api.github.com/users/petkaantonov/orgs","repos_url":"https://api.github.com/users/petkaantonov/repos","events_url":"https://api.github.com/users/petkaantonov/events{/privacy}","received_events_url":"https://api.github.com/users/petkaantonov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-03-26T16:51:08Z","updated_at":"2015-03-26T19:48:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/libuv/libuv/pulls/291","html_url":"https://github.com/libuv/libuv/pull/291","diff_url":"https://github.com/libuv/libuv/pull/291.diff","patch_url":"https://github.com/libuv/libuv/pull/291.patch"},"body":"cc @bnoordhuis "},"comment":{"url":"https://api.github.com/repos/libuv/libuv/issues/comments/86688516","html_url":"https://github.com/libuv/libuv/pull/291#issuecomment-86688516","issue_url":"https://api.github.com/repos/libuv/libuv/issues/291","id":86688516,"user":{"login":"saghul","id":317464,"avatar_url":"https://avatars.githubusercontent.com/u/317464?v=3","gravatar_id":"","url":"https://api.github.com/users/saghul","html_url":"https://github.com/saghul","followers_url":"https://api.github.com/users/saghul/followers","following_url":"https://api.github.com/users/saghul/following{/other_user}","gists_url":"https://api.github.com/users/saghul/gists{/gist_id}","starred_url":"https://api.github.com/users/saghul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saghul/subscriptions","organizations_url":"https://api.github.com/users/saghul/orgs","repos_url":"https://api.github.com/users/saghul/repos","events_url":"https://api.github.com/users/saghul/events{/privacy}","received_events_url":"https://api.github.com/users/saghul/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T19:48:22Z","updated_at":"2015-03-26T19:48:22Z","body":"> For instance there is a bug in OS X where the internal async handle used for the select loop that backs streams to /dev segfaults in uv_async_event due to use-after-free - it took me quite long to realize it's not my async handle at all but the libuv internal async handle.\r\n> \r\n> In general I see the workers implemenationg exposing many more bugs in libuv and this function would be very helpful - it is absolutely crucial that all handles are always closed when a worker terminates because we cannot rely on OS doing that for us anymore.\r\n\r\nI can try to guess what those workers are, but I'm not familiar with your work there.\r\n\r\nI assume you need to close a loop. libuv returns an error if you try to close a loop with active handles, so if you run into a problem is likely you're not closing the loop right. If you need to be absolutely certain that a loop is closed you can do the following:\r\n\r\n* uv_walk all handles and call uv_close on them\r\n* call uv_run with UV_RUN_DEFAULT mode\r\n* call uv_loop_close, it must return 0, if it doesn't there is an internal problem in libuv.\r\n* memory can now be safely released\r\n"}}