{"action":"created","issue":{"url":"https://api.github.com/repos/sociomantic-tsunami/ocean/issues/67","repository_url":"https://api.github.com/repos/sociomantic-tsunami/ocean","labels_url":"https://api.github.com/repos/sociomantic-tsunami/ocean/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/sociomantic-tsunami/ocean/issues/67/comments","events_url":"https://api.github.com/repos/sociomantic-tsunami/ocean/issues/67/events","html_url":"https://github.com/sociomantic-tsunami/ocean/pull/67","id":217920396,"number":67,"title":"Add close-on-exec option for sockets, timers and events","user":{"login":"david-eckardt-sociomantic","id":2952846,"avatar_url":"https://avatars0.githubusercontent.com/u/2952846?v=3","gravatar_id":"","url":"https://api.github.com/users/david-eckardt-sociomantic","html_url":"https://github.com/david-eckardt-sociomantic","followers_url":"https://api.github.com/users/david-eckardt-sociomantic/followers","following_url":"https://api.github.com/users/david-eckardt-sociomantic/following{/other_user}","gists_url":"https://api.github.com/users/david-eckardt-sociomantic/gists{/gist_id}","starred_url":"https://api.github.com/users/david-eckardt-sociomantic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-eckardt-sociomantic/subscriptions","organizations_url":"https://api.github.com/users/david-eckardt-sociomantic/orgs","repos_url":"https://api.github.com/users/david-eckardt-sociomantic/repos","events_url":"https://api.github.com/users/david-eckardt-sociomantic/events{/privacy}","received_events_url":"https://api.github.com/users/david-eckardt-sociomantic/received_events","type":"User","site_admin":false},"labels":[{"id":400885728,"url":"https://api.github.com/repos/sociomantic-tsunami/ocean/labels/type-feature","name":"type-feature","color":"ccffff","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/sociomantic-tsunami/ocean/milestones/12","html_url":"https://github.com/sociomantic-tsunami/ocean/milestone/12","labels_url":"https://api.github.com/repos/sociomantic-tsunami/ocean/milestones/12/labels","id":2416914,"number":12,"title":"v2.8.0","description":"","creator":{"login":"mihails-strasuns-sociomantic","id":4718368,"avatar_url":"https://avatars0.githubusercontent.com/u/4718368?v=3","gravatar_id":"","url":"https://api.github.com/users/mihails-strasuns-sociomantic","html_url":"https://github.com/mihails-strasuns-sociomantic","followers_url":"https://api.github.com/users/mihails-strasuns-sociomantic/followers","following_url":"https://api.github.com/users/mihails-strasuns-sociomantic/following{/other_user}","gists_url":"https://api.github.com/users/mihails-strasuns-sociomantic/gists{/gist_id}","starred_url":"https://api.github.com/users/mihails-strasuns-sociomantic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mihails-strasuns-sociomantic/subscriptions","organizations_url":"https://api.github.com/users/mihails-strasuns-sociomantic/orgs","repos_url":"https://api.github.com/users/mihails-strasuns-sociomantic/repos","events_url":"https://api.github.com/users/mihails-strasuns-sociomantic/events{/privacy}","received_events_url":"https://api.github.com/users/mihails-strasuns-sociomantic/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":1,"state":"open","created_at":"2017-03-28T15:01:54Z","updated_at":"2017-03-30T11:48:37Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2017-03-29T15:44:11Z","updated_at":"2017-04-03T13:02:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sociomantic-tsunami/ocean/pulls/67","html_url":"https://github.com/sociomantic-tsunami/ocean/pull/67","diff_url":"https://github.com/sociomantic-tsunami/ocean/pull/67.diff","patch_url":"https://github.com/sociomantic-tsunami/ocean/pull/67.patch"},"body":"Some of our applications spawn new processes, which inherit all file descriptors by default but neither use nor close them until they terminate. Consequently the parent process cannot close any device associated with a file descriptor because the child process keeps it open. One consequence, which caused a bug that was hard to reproduce and track down, is that file descriptors in epoll are not automatically unregistered when closing them.\r\nThe solution is to enable the close-on-exec option for every single file descriptor, which prevents the child process from inheriting it. Fortunately on Linux all functions that create a file descriptor accept an option to enable close-on-exec. Add this option to the ocean facilities that create file descriptors which are usually registered with epoll.\r\nThere are still two open points:\r\n1. To avoid a breaking change the close-on-exec option is disabled by default so it is up to user code to enable it. I think it should really be enabled by default because it protects from sporadic errors that can be severe and hard to debug -- or do we have an application that spawns a process which needs to use the parent's socket, timer, event or epoll file descriptors?\r\n2. `EpollProcess` is affected as well, in particular the `SIGCHLD` select event in its `GlobalProcessMonitor`. Since a global singleton instance of this class is used I am not sure how to add close-on-exec without a breaking change."},"comment":{"url":"https://api.github.com/repos/sociomantic-tsunami/ocean/issues/comments/291135891","html_url":"https://github.com/sociomantic-tsunami/ocean/pull/67#issuecomment-291135891","issue_url":"https://api.github.com/repos/sociomantic-tsunami/ocean/issues/67","id":291135891,"user":{"login":"nemanja-boric-sociomantic","id":7437552,"avatar_url":"https://avatars1.githubusercontent.com/u/7437552?v=3","gravatar_id":"","url":"https://api.github.com/users/nemanja-boric-sociomantic","html_url":"https://github.com/nemanja-boric-sociomantic","followers_url":"https://api.github.com/users/nemanja-boric-sociomantic/followers","following_url":"https://api.github.com/users/nemanja-boric-sociomantic/following{/other_user}","gists_url":"https://api.github.com/users/nemanja-boric-sociomantic/gists{/gist_id}","starred_url":"https://api.github.com/users/nemanja-boric-sociomantic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nemanja-boric-sociomantic/subscriptions","organizations_url":"https://api.github.com/users/nemanja-boric-sociomantic/orgs","repos_url":"https://api.github.com/users/nemanja-boric-sociomantic/repos","events_url":"https://api.github.com/users/nemanja-boric-sociomantic/events{/privacy}","received_events_url":"https://api.github.com/users/nemanja-boric-sociomantic/received_events","type":"User","site_admin":false},"created_at":"2017-04-03T13:02:04Z","updated_at":"2017-04-03T13:02:04Z","body":"Some other thoughts:\r\n\r\nhttp://udrepper.livejournal.com/20407.html (from Ulrich Drepper)\r\n\r\n> In glibc we do now in almost all interfaces open the file descriptor with the close-on-exec flag set. This means a lot of work but it has to be done. \r\n\r\n"}}
{"actor":{"display_login":"nemanja-boric-sociomantic"}}