ircanywhere / ircanywhere

IRCAnywhere web based multi-user IRC bouncer built for teams

Home Page:http://ircanywhere.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I get the following for messages that are too long: "TypeError: Cannot read property 'numAsyncPres' of undefined"

samertm opened this issue · comments

I get this error when I try to connect to irc.rizon.net. I also get the error when pasting the error into irc:

2014-09-23T04:46:42.401Z - error: TypeError: Cannot read property 'numAsyncPres' of undefined
    at ServerSession.module.exports._lazySetupHooks (/home/samer/src/ircanywhere/node_modules/hooks/hooks.js:162:49)
    at ServerSession.module.exports.post (/home/samer/src/ircanywhere/node_modules/hooks/hooks.js:143:10)
    at /home/samer/src/ircanywhere/server/serverSession.js:67:18
    at Array.forEach (native)
    at Socket.<anonymous> (/home/samer/src/ircanywhere/server/serverSession.js:58:9)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:746:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)

I noticed that I can paste every line individually without it crashing, and there's something nefarious that happens with the combination of the number of characters in the message and the number of newlines. Pasting this message into the chat box will always crash ircanywhere:

2014-09-23T04:46:42.401Z - error: TypeError: Cannot read property 'numAsyncPres' of undefined
    at ServerSession.module.exports._lazySetupHooks (/home/samer/src/ircanywhere/node_modules/hooks/hooks.js:162:49)
    at ServerSession.module.exports.post (/home/samer/src/ircanywhere/node_modules/hooks/hooks.js:143:10)
    at /home/samer/src/ircanywhere/server/serverSession.js:67:18
    at Array.forEach (native)
    at Socket.<anonymous> (/home/samer/src/ircanywhere/server/serverSession.js:5

But a message one character shorter (drop the last '5') won't. The message is exactly 493 characters long. But when I paste 493 'u's, it doesn't crash, but it does insert a newline before the last two 'u's:

uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

This is another error that shows up if you try to crash ircanywhere in this way:

2014-09-23T05:12:18.263Z - error:  
{ stack: 'Error: Newline detected in message. Use multiple raws instead.\n    at EventEmitter.create.raw (/home/samer/src/ircanywhere/node_modules/irc-factory/node_modules/irc-socket/irc-socket.js:177:19)\n    at Client.raw (/home/samer/src/ircanywhere/node_modules/irc-factory/lib/irc.js:1166:19)\n    at Client.<anonymous> (/home/samer/src/ircanywhere/node_modules/irc-factory/lib/irc.js:1263:8)\n    at cutAndSend (/home/samer/src/ircanywhere/node_modules/irc-factory/lib/irc.js:1235:4)\n    at Client.privmsg (/home/samer/src/ircanywhere/node_modules/irc-factory/lib/irc.js:1271:2)\n    at Parser.<anonymous> (/home/samer/src/ircanywhere/node_modules/irc-factory/lib/api.js:122:27)\n    at Parser.onmessage (/home/samer/src/ircanywhere/node_modules/irc-factory/node_modules/axon/lib/sockets/sub-emitter.js:52:21)\n    at Parser.frameBody (/home/samer/src/ircanywhere/node_modules/irc-factory/node_modules/axon/lib/parser.js:106:10)\n    at Parser.write (/home/samer/src/ircanywhere/node_modules/irc-factory/node_modules/axon/lib/parser.js:50:13)\n    at Parser.frameHeader (/home/samer/src/ircanywhere/node_modules/irc-factory/node_modules/axon/lib/parser.js:81:30)',
  message: 'Newline detected in message. Use multiple raws instead.' }

But I don't get the error when I paste this (I do get disconnected for flooding, though):

uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu
uuuuu

Ok, the first thing I've done here is help you out by preventing the Error: Newline detected in message. Use multiple raws instead. crash from happening. This happens way down in irc-socket. Which isn't my module, although I do have push access to it, I don't want to introduce breaking changes right now (and I can't publish a new version).

So I've moved it over to https://github.com/ircanywhere/irc-socket which should fix that crash, I've updated irc-factory to use that module, so a npm install will be in order. That should at least fix the third crash, as for the first two, they look like the hooks have maybe been setup incorrectly on the ServerSession module.