{"action":"created","issue":{"url":"https://api.github.com/repos/nanomsg/nanomsg/issues/502","labels_url":"https://api.github.com/repos/nanomsg/nanomsg/issues/502/labels{/name}","comments_url":"https://api.github.com/repos/nanomsg/nanomsg/issues/502/comments","events_url":"https://api.github.com/repos/nanomsg/nanomsg/issues/502/events","html_url":"https://github.com/nanomsg/nanomsg/pull/502","id":113622789,"number":502,"title":"Assertion or Access Violation when calling nn_close while nn_recv blocks in separate thread","user":{"login":"wirebirdlabs","id":1944203,"avatar_url":"https://avatars.githubusercontent.com/u/1944203?v=3","gravatar_id":"","url":"https://api.github.com/users/wirebirdlabs","html_url":"https://github.com/wirebirdlabs","followers_url":"https://api.github.com/users/wirebirdlabs/followers","following_url":"https://api.github.com/users/wirebirdlabs/following{/other_user}","gists_url":"https://api.github.com/users/wirebirdlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/wirebirdlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wirebirdlabs/subscriptions","organizations_url":"https://api.github.com/users/wirebirdlabs/orgs","repos_url":"https://api.github.com/users/wirebirdlabs/repos","events_url":"https://api.github.com/users/wirebirdlabs/events{/privacy}","received_events_url":"https://api.github.com/users/wirebirdlabs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-27T16:19:14Z","updated_at":"2015-10-27T16:48:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nanomsg/nanomsg/pulls/502","html_url":"https://github.com/nanomsg/nanomsg/pull/502","diff_url":"https://github.com/nanomsg/nanomsg/pull/502.diff","patch_url":"https://github.com/nanomsg/nanomsg/pull/502.patch"},"body":"This pull request demonstrates and partially addresses another type of multithreading problem during TCP Shutdown on Windows.\r\n\r\nIt is split into two commits on purpose:\r\n\r\n1) the first commit demonstrates the current issue in the form of a test -- the assertion failure in `efd.c`\r\n2) the second commit fixes this issue by giving Windows platforms the same semantics as *NIX platforms, as shown above in `efd.c`\r\n\r\n**However** -- this patch turns a guaranteed failure (old line 70 of `efd.c`) into a race condition within `sock.c`.\r\n\r\nTo best demonstrate this race condition, increase `TEST3_LOOPS ` in line 41 of `tcp_shutdown.c` test to be 10 or 100 iterations.\r\n\r\nThe current value of 1 iteration makes a lower likelihood of the race condition showing up, but it certainly still can manifest."},"comment":{"url":"https://api.github.com/repos/nanomsg/nanomsg/issues/comments/151565093","html_url":"https://github.com/nanomsg/nanomsg/pull/502#issuecomment-151565093","issue_url":"https://api.github.com/repos/nanomsg/nanomsg/issues/502","id":151565093,"user":{"login":"gdamore","id":1295229,"avatar_url":"https://avatars.githubusercontent.com/u/1295229?v=3","gravatar_id":"","url":"https://api.github.com/users/gdamore","html_url":"https://github.com/gdamore","followers_url":"https://api.github.com/users/gdamore/followers","following_url":"https://api.github.com/users/gdamore/following{/other_user}","gists_url":"https://api.github.com/users/gdamore/gists{/gist_id}","starred_url":"https://api.github.com/users/gdamore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdamore/subscriptions","organizations_url":"https://api.github.com/users/gdamore/orgs","repos_url":"https://api.github.com/users/gdamore/repos","events_url":"https://api.github.com/users/gdamore/events{/privacy}","received_events_url":"https://api.github.com/users/gdamore/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T16:48:03Z","updated_at":"2015-10-27T16:48:03Z","body":"Could be -- if you are expecting to receive that signal to wake up the thread.  However, most operating systems actually disable receipt of the SIGPIPE signal elsewhere, and return EPIPE inline.  (So for example, this shouldn't be an issue on Linux.  Unless disabling SIGPIPE somehow also disables the kernel from returning EPIPE or EBADFD on a closed pipe?\r\n"}}