Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition, mode+- before mode= seems to cause crash #65

Closed
thejh opened this issue Nov 15, 2011 · 0 comments
Closed

Race condition, mode+- before mode= seems to cause crash #65

thejh opened this issue Nov 15, 2011 · 0 comments

Comments

@thejh
Copy link
Contributor

thejh commented Nov 15, 2011

> var irc=require('irc')
undefined
> var client = new irc.Client('irc.freenode.net', 'test378546', {channels:['#node.ks']})
undefined
> 
/home/jann/tmp/node_modules/irc/lib/irc.js:511
                    throw err;
                          ^
TypeError: Cannot call method 'indexOf' of undefined
    at /home/jann/tmp/node_modules/irc/lib/irc.js:158:47
    at Array.forEach (native)
    at Client.<anonymous> (/home/jann/tmp/node_modules/irc/lib/irc.js:137:26)
    at Client.emit (events.js:67:17)
    at /home/jann/tmp/node_modules/irc/lib/irc.js:508:22
    at Array.forEach (native)
    at Socket.<anonymous> (/home/jann/tmp/node_modules/irc/lib/irc.js:505:15)
    at Socket.emit (events.js:67:17)
    at TCP.onread (net.js:322:31)

Wiresharks logs:

JOIN :#node.ks
:[email protected] JOIN #node.ks
:sendak.freenode.net MODE #node.ks +ns
:sendak.freenode.net 353 test378546 @ #node.ks :@test378546
:sendak.freenode.net 366 test378546 #node.ks :End of /NAMES list.
[node crashed]

Code looks like the mode change handler expects the mode to be set, but node-irc requests the mode explicitely after joining so that automatic network-caused mode changes happen before the absolute mode is known. Just ignoring might cause node-irc to see a wrong channelmodes, so maybe it should just rerequest the absolute mode when such things happen? E.g. have a "relative changes happened" flag, set it to false on requesting absolute mode, set it to true when changes happen. When an absolute mode comes in and "relative changes happened" is true, rerequest.

Half-Shot referenced this issue in matrix-org/node-irc Feb 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants