-
Notifications
You must be signed in to change notification settings - Fork 423
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
maxLineLength is not set by default and can crash the bot #419
Comments
can you post the error that you get? This is because there is no "onConnection" or "onReady" events yet, and as far as i know you only need to try to send a message to get the same error: i.e. |
The notice event that nickserv uses fires before |
Right, so this causes the same error:
Can you post your temporary work around too? |
Ah, well my workaround was to not use the NickServ helper because it didn't seem to want to work even after fixing this problem. :) Here is what I did just to get on with my testing: Starting at line 95, note the if (self.opt.floodProtection) {
self.activateFloodProtection();
}
self.hostMask = '';
self.maxLineLength = 450;
// TODO - fail if nick or server missing
// TODO - fail if username has a space in it
if (self.opt.autoConnect === true) {
self.connect();
} I don't think this is the appropriate workaround, but it is a quick fix with minimal impact. |
That gives a whole new error :(
Perhaps those TODO's would actually solve this:
I'm not sure where the server sub-object lives, but my guess that needs to be checked and return a code error, i haven't looked at the ./lib/codes.js but there may already be a code for "the server is currently not available" or something similar. |
I have the exact same error trying to send something I'm guessing too quickly. I do see a 'ready' event. Would that be useful to wait for? |
sorry for beating around the bush, but after i went through the docs again i found that this does indeed work:
@brandonros i tried as a 'ready' event, but that did not work, where did you see that? |
@jnull that works BECAUSE the message waits untill the server tells the user that that nickname is registered. if you try to I propose, as a workaround, to add maxLineLength to the |
Lines 116-131:
I don't believe that's right, maxLineLength was only a symptom, the soonest you can send a message is after you have a valid nick. The server may change your nick on the connection registration so self._updateMaxLineLength(); needs to be called, after all of that, the event 'registered' is emitted (IMHO, the overall best way to handle the situation). @swichers btw 'nickserv' module was abandoned by the owner, the last commit was June 2014, you may want to look for a different 'NickServ' project or fork as they suggested. |
I suggest we move this to closed, as the solution was found to use the event "registered". |
Do you disagree that it is a bug that sending a message on connection, but before certain events have fired, can cause the bot to crash? I feel like that should, at minimum, just return false instead of pooping the bed. |
I actually prefer a noisy crash because it reminds us that something isn't perfect, but a silent crash will become much, much more frustrating to troubleshoot for the users. I think this is an overdue enhancement for all commands to gracefully fail #421. |
@jnull my bad, I was referring to the following code (below) - I remember seeing (on occasion, and through my znc) the server sending back a bunch of properties - I gather the updateMaxLineLength prop comes in one of those messages (but maybe not these that we are ignoring). I'll read the RFC, soon as I get some time to "waste", and come back with newfound ideas :)
|
Ya, those are just unhandled messages for different server(s) during the irc client "registration"/connection phase. As the comment suggests:
They are benign, one of them might be better for listening for something else, but you can't get any closer to the successful connection then code 001 'rpl_welcome'. Lets move our discussion to #421 for graceful error messages so we can close this issue. |
Stumbled on this issue due to someone opening an issue on the nickserv module. I think I abandoned it because different NickServ servers with different messages made it inconsistent. Anyway, I fixed the issue, anyone that was trying it, feel free to try it again. |
If you connect with the bot and try to send something before _updateMaxLineLength is called then the bot will crash. This code should duplicate the problem by trying to message NickServ before _updateMaxLineLength has been called.
The text was updated successfully, but these errors were encountered: