{"action":"opened","issue":{"url":"https://api.github.com/repos/npat-efault/poller/issues/3","labels_url":"https://api.github.com/repos/npat-efault/poller/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/npat-efault/poller/issues/3/comments","events_url":"https://api.github.com/repos/npat-efault/poller/issues/3/events","html_url":"https://github.com/npat-efault/poller/issues/3","id":85042076,"number":3,"title":"Close method is unsafe.","user":{"login":"jaracil","id":6370372,"avatar_url":"https://avatars.githubusercontent.com/u/6370372?v=3","gravatar_id":"","url":"https://api.github.com/users/jaracil","html_url":"https://github.com/jaracil","followers_url":"https://api.github.com/users/jaracil/followers","following_url":"https://api.github.com/users/jaracil/following{/other_user}","gists_url":"https://api.github.com/users/jaracil/gists{/gist_id}","starred_url":"https://api.github.com/users/jaracil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaracil/subscriptions","organizations_url":"https://api.github.com/users/jaracil/orgs","repos_url":"https://api.github.com/users/jaracil/repos","events_url":"https://api.github.com/users/jaracil/events{/privacy}","received_events_url":"https://api.github.com/users/jaracil/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-04T11:01:41Z","updated_at":"2015-06-04T11:01:41Z","closed_at":null,"body":"If Close method is called more than one time then the second call could close an invalid or in use file descriptor.\r\n\r\nI think this method must check fd.closed flag:\r\n\r\n\r\nfunc (fd *FD) Close() error {\r\n\t// Take both locks, to exclude read and write operations from\r\n\t// accessing a closed sysfd.\r\n\tif err := fd.Lock(); err != nil {\r\n\t\tdebugf(\"FD %03d: CL: Closed\", fd.id)\r\n \t\treturn err\r\n \t}\r\n \tdefer fd.Unlock()\r\n+\tif fd.closed {\r\n+\t\treturn ErrClosed\r\n+\t}\r\n \tfd.closed = true\r\n       ....\r\n\r\n\r\nThanks."}}