{"action":"created","issue":{"url":"https://api.github.com/repos/zeromq/libzmq/issues/1108","labels_url":"https://api.github.com/repos/zeromq/libzmq/issues/1108/labels{/name}","comments_url":"https://api.github.com/repos/zeromq/libzmq/issues/1108/comments","events_url":"https://api.github.com/repos/zeromq/libzmq/issues/1108/events","html_url":"https://github.com/zeromq/libzmq/issues/1108","id":36465887,"number":1108,"title":"assertion failure in mailbox.cpp:82","user":{"login":"hintjens","id":307976,"avatar_url":"https://avatars.githubusercontent.com/u/307976?v=3","gravatar_id":"","url":"https://api.github.com/users/hintjens","html_url":"https://github.com/hintjens","followers_url":"https://api.github.com/users/hintjens/followers","following_url":"https://api.github.com/users/hintjens/following{/other_user}","gists_url":"https://api.github.com/users/hintjens/gists{/gist_id}","starred_url":"https://api.github.com/users/hintjens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hintjens/subscriptions","organizations_url":"https://api.github.com/users/hintjens/orgs","repos_url":"https://api.github.com/users/hintjens/repos","events_url":"https://api.github.com/users/hintjens/events{/privacy}","received_events_url":"https://api.github.com/users/hintjens/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"hurtonm","id":46782,"avatar_url":"https://avatars.githubusercontent.com/u/46782?v=3","gravatar_id":"","url":"https://api.github.com/users/hurtonm","html_url":"https://github.com/hurtonm","followers_url":"https://api.github.com/users/hurtonm/followers","following_url":"https://api.github.com/users/hurtonm/following{/other_user}","gists_url":"https://api.github.com/users/hurtonm/gists{/gist_id}","starred_url":"https://api.github.com/users/hurtonm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hurtonm/subscriptions","organizations_url":"https://api.github.com/users/hurtonm/orgs","repos_url":"https://api.github.com/users/hurtonm/repos","events_url":"https://api.github.com/users/hurtonm/events{/privacy}","received_events_url":"https://api.github.com/users/hurtonm/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2014-06-25T10:17:20Z","updated_at":"2015-01-06T20:51:13Z","closed_at":null,"body":"## Environment\r\n* OS - MS Windows 7 Ultimate SP1,\r\n* Compiler - Visual Studio 2013\r\n* Version of ZeroMQ - 4.0.4, both variants: linking compiled dll and compile ZMQ source code.\r\n* We checked previous stable version 3.2.4 and development master on github - the same problem\r\n\r\n## How to reproduce\r\n\r\nThe C++ application is running and in several hours zmq_assert raises an exception in zmq::mailbox_t::recv line 82 and the application is crashed. Timeout isn't constant, could be 4 hours and more. It occurs even if the application has not had any zeromq tcp connections.\r\n\r\nWe found that ZeroMQ creates internal tcp connection (several sockets). It passes signals between zeromq threads or something else. But this is other sockets than for publisher-subsribers connection.\r\n\r\nThe exception raises when a disconnect event occurs in this internal tcp connection (got it in an network sniffer). We didn't find who initiated disconnect; we didn't find that ZeroMQ calls socket closing before.\r\n\r\nThe disconnect event changes the status of socket for WinSock select() method, it generates an read operation:\r\n\r\n    void zmq::select_t::loop ()\r\n    {\r\n        . . .\r\n        if (FD_ISSET (fds [i].fd, &readfds))\r\n            fds [i].events->in_event ();          ß line 197\r\n        . . .\r\n    }\r\n\r\nhttp://msdn.microsoft.com/en-us/library/windows/desktop/ms740141(v=vs.85).aspx\r\n\r\nreadfds:\r\n\r\n* If listen has been called and a connection is pending, accept will succeed.\r\n* Data is available for reading (includes OOB data if SO_OOBINLINE is enabled).\r\n* Connection has been closed/reset/terminated.\r\n\r\nThen ZeroMQ is trying to read data from socket:\r\n\r\n    void zmq::io_thread_t::in_event ()\r\n    {\r\n        . . .\r\n        command_t cmd;\r\n        int rc = mailbox.recv (&cmd, 0);                  ß line 69\r\n        . . .\r\n    }\r\n\r\nAnd it raises an exception on checks after reading because there is nothing to read:\r\n\r\n    int zmq::mailbox_t::recv (command_t *cmd_, int timeout_)\r\n    {\r\n        . . .\r\n        //  Get a command.\r\n        errno_assert (rc == 0);\r\n        bool ok = cpipe.read (cmd_);\r\n        zmq_assert (ok);                                   ß line 82 (crashed here)\r\n        return 0;\r\n    }"},"comment":{"url":"https://api.github.com/repos/zeromq/libzmq/issues/comments/68931363","html_url":"https://github.com/zeromq/libzmq/issues/1108#issuecomment-68931363","issue_url":"https://api.github.com/repos/zeromq/libzmq/issues/1108","id":68931363,"user":{"login":"rodgert","id":120839,"avatar_url":"https://avatars.githubusercontent.com/u/120839?v=3","gravatar_id":"","url":"https://api.github.com/users/rodgert","html_url":"https://github.com/rodgert","followers_url":"https://api.github.com/users/rodgert/followers","following_url":"https://api.github.com/users/rodgert/following{/other_user}","gists_url":"https://api.github.com/users/rodgert/gists{/gist_id}","starred_url":"https://api.github.com/users/rodgert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodgert/subscriptions","organizations_url":"https://api.github.com/users/rodgert/orgs","repos_url":"https://api.github.com/users/rodgert/repos","events_url":"https://api.github.com/users/rodgert/events{/privacy}","received_events_url":"https://api.github.com/users/rodgert/received_events","type":"User","site_admin":false},"created_at":"2015-01-06T20:51:13Z","updated_at":"2015-01-06T20:51:13Z","body":"Any sort of stack trace? Without it, there's essentially no way to diagnose."}}