{"action":"created","issue":{"url":"https://api.github.com/repos/inotify-rs/inotify/issues/104","repository_url":"https://api.github.com/repos/inotify-rs/inotify","labels_url":"https://api.github.com/repos/inotify-rs/inotify/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/inotify-rs/inotify/issues/104/comments","events_url":"https://api.github.com/repos/inotify-rs/inotify/issues/104/events","html_url":"https://github.com/inotify-rs/inotify/pull/104","id":330453957,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzNDYxNDc3","number":104,"title":"refactor: Add FdGuard responsible for close-on-drop","user":{"login":"hawkw","id":2796466,"node_id":"MDQ6VXNlcjI3OTY0NjY=","avatar_url":"https://avatars1.githubusercontent.com/u/2796466?v=4","gravatar_id":"","url":"https://api.github.com/users/hawkw","html_url":"https://github.com/hawkw","followers_url":"https://api.github.com/users/hawkw/followers","following_url":"https://api.github.com/users/hawkw/following{/other_user}","gists_url":"https://api.github.com/users/hawkw/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkw/subscriptions","organizations_url":"https://api.github.com/users/hawkw/orgs","repos_url":"https://api.github.com/users/hawkw/repos","events_url":"https://api.github.com/users/hawkw/events{/privacy}","received_events_url":"https://api.github.com/users/hawkw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-06-07T22:11:56Z","updated_at":"2018-06-11T21:19:37Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/inotify-rs/inotify/pulls/104","html_url":"https://github.com/inotify-rs/inotify/pull/104","diff_url":"https://github.com/inotify-rs/inotify/pull/104.diff","patch_url":"https://github.com/inotify-rs/inotify/pull/104.patch"},"body":"This commit improves the close-on-drop behaviour for file descriptors,\r\nby adding a `FdGuard` struct that wraps the file descriptor and is\r\nresponsible for closing it when it is dropped. Rather than having an\r\n`Inotify` own an `Arc<RawFd>`, and be responsible for clsoing it,\r\n`Inotify` now owns an `Arc<FdGuard>`, and the `FdGuard` is responsible\r\nfor closing the fd.\r\n\r\nThis allows us to share the file descriptor between an `Inotify` and\r\nan `EventStream`, and close the file descriptor only when the `Arc` is\r\ndropped (i.e., when both the `Inotify` _and_ the `EventStream` are\r\ndropped). This makes the `Inotify::into_event_stream` I added in #103\r\nunnecessary, so I've gone ahead and deprecated it."},"comment":{"url":"https://api.github.com/repos/inotify-rs/inotify/issues/comments/396390877","html_url":"https://github.com/inotify-rs/inotify/pull/104#issuecomment-396390877","issue_url":"https://api.github.com/repos/inotify-rs/inotify/issues/104","id":396390877,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjM5MDg3Nw==","user":{"login":"hawkw","id":2796466,"node_id":"MDQ6VXNlcjI3OTY0NjY=","avatar_url":"https://avatars1.githubusercontent.com/u/2796466?v=4","gravatar_id":"","url":"https://api.github.com/users/hawkw","html_url":"https://github.com/hawkw","followers_url":"https://api.github.com/users/hawkw/followers","following_url":"https://api.github.com/users/hawkw/following{/other_user}","gists_url":"https://api.github.com/users/hawkw/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkw/subscriptions","organizations_url":"https://api.github.com/users/hawkw/orgs","repos_url":"https://api.github.com/users/hawkw/repos","events_url":"https://api.github.com/users/hawkw/events{/privacy}","received_events_url":"https://api.github.com/users/hawkw/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T21:19:37Z","updated_at":"2018-06-11T21:19:37Z","author_association":"CONTRIBUTOR","body":"@hannobraun I believe what happened there is that passing in the wrong variant normally panics with an actually descriptive message saying something to the effect of \"releasing on a load is impossible\". But, since the load was inside of a `Drop` impl here, it was called while panicking (presumably due to a test failure?), causing a double panic, and double panics kill the program with a SIGILL.\r\n\r\nPersonally, I think using panics to signal test failure may have been a poor design choice. They cause double panics like that to occur in code that wouldn't normally panic, resulting in a hard to debug error message. But, that's what we've got, so 🤷‍♀️ "}}
{"actor":{"display_login":"hawkw"}}