{"comment":{"created_at":"2011-10-26T00:36:55Z","body":"I believe I'm seeing this, or something similar.  In this case I had a remote (over the Internet) client lose their connection and time out.  Looking back through the console output I see a line like this:\r\n\r\n    *** ERROR: Error: ETIMEDOUT, Connection timed out\r\n\r\nwhich I believe comes from **server.error()** as a result of the 'error' event on the stream.  Then, later, I see the following when sending a message to a channel that user was joined to:\r\n\r\n````\r\n[irc.redacted.com, C: jclulow] PRIVMSG #channel :test\r\nS: [ben] :jclulow!jclulow@client.redacted.com PRIVMSG #channel :test\r\n{ stack: [Getter/Setter],\r\n  arguments: undefined,\r\n  type: undefined,\r\n  message: 'Socket is not writable' }\r\n````\r\n\r\nSo it looks like when there's a socket error, perhaps the 'end' event isn't firing on the stream.  **server.end(client)** is then never called.  I'm going to give the following a go:\r\n\r\n````diff\r\ndiff --git a/lib/server.js b/lib/server.js\r\nindex 1b0ba1f..3ec0072 100644\r\n--- a/lib/server.js\r\n+++ b/lib/server.js\r\n@@ -179,7 +179,7 @@ Server.prototype = {\r\n         client.object = new User(client.stream, server);\r\n \r\n         stream.on('end', function() { server.end(client); });\r\n-        stream.on('error', server.error);\r\n+        stream.on('error', function(error) { server.error(error); server.end(client); });\r\n         carry.on('line',  function(line) { server.data(client, line); });\r\n       } catch (exception) {\r\n         log('Fatal error: ', exception);\r\n````","updated_at":"2011-10-26T00:36:55Z","url":"https://api.github.com/repos/alexyoung/ircd.js/issues/comments/2525082","id":2525082,"user":{"gravatar_id":"a9bbfd66936da88aaaf549841fca7aad","avatar_url":"https://secure.gravatar.com/avatar/a9bbfd66936da88aaaf549841fca7aad?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jclulow","id":304070,"login":"jclulow"}},"action":"created","issue":{"number":10,"created_at":"2011-09-23T18:39:52Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"When user leaves sometimes nick is not removed from channel.  I'm not sure if it only happens when the user disconnects but that seems to be the trigger.  Thus, you end up with duplicate nicks in the channel.","comments":3,"title":"When user leaves sometimes nick is not removed from channel","updated_at":"2011-10-26T00:36:55Z","url":"https://api.github.com/repos/alexyoung/ircd.js/issues/10","id":1725689,"assignee":null,"milestone":null,"closed_at":null,"user":{"gravatar_id":"ca83c31ce6a7f1b8cd7c840ed69f0242","avatar_url":"https://secure.gravatar.com/avatar/ca83c31ce6a7f1b8cd7c840ed69f0242?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/willfred","id":1072301,"login":"willfred"},"html_url":"https://github.com/alexyoung/ircd.js/issues/10","labels":[],"state":"open"},"legacy":{"issue_id":1725689,"comment_id":2525082}}