jbnc icon indicating copy to clipboard operation
jbnc copied to clipboard

An error occurred at 1:36 a.m., which I couldn't correct

Open Madriix opened this issue 1 year ago • 6 comments

Hi, there was a crash at 1:36 AM, and PM2 restarted everything right after. Here's the error:

TypeError: Cannot create property 'mobile' on boolean 'false'
    at ClientReconnect.init (/home/debian/node/jbnc/lib/ClientReconnect.js:22:54)
    at new ClientReconnect (/home/debian/node/jbnc/lib/ClientReconnect.js:8:10)
    at Server.clientReconnect (/home/debian/node/jbnc/lib/Server.js:734:16)
    at TLSSocket.<anonymous> (/home/debian/node/jbnc/lib/Server.js:331:58)
    at TLSSocket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)

dragon||AJFiej2fn2345/irc.dal.net:6667||somepassword/mobile or dragon||AJFiej2fn2345/irc.dal.net:6667/mobile

In the entire code, I can't find any occurrence of the word 'mobile'; it seems to be related to the PASS command.

If I can't find it, I'll have to uncomment 'uncaughtException,' which is a shame because it's the first time it has crashed and there's only one mobile error. Rare bug.

Madriix avatar Apr 22 '24 00:04 Madriix

That's very confusing. Is the client connecting somehow with 'mobile' in their connection?

realrasengan avatar Apr 22 '24 00:04 realrasengan

I would try to reproduce the bug by replacing "dragon||AJFiej2fn2345/irc.dal.net:6667||somepassword/mobile" with "mobile" and making other test it. Otherwise, I don't know how to reproduce the bug. Maybe I need to bring the computer and then connect with the mobile; I will also try that.

Madriix avatar Apr 22 '24 00:04 Madriix

I manage to reproduce the bug. Just do this:

  1. Open 2 different JBNC servers, one with a connected nickname (example: Testor on the dedicated server)
  2. Then turn on your JBNC on the PC and also put "Testor" it will say that your nickname is already taken, do not disconnect, it will put this:
[03:37:45] * Connecting to 127.0.0.1 (8888)
[03:37:45] -irc.d.com- *** Looking up your hostname...
[03:37:45] -irc.d.com- *** Found your hostname (cached)
[03:37:45] Le nickname (Carly) est déjà utilisé.
[03:37:45] Le nickname (.) est erroné.
[03:37:45] You are now logged in as Carly.
[03:37:45] SASL authentication successful
[03:37:45] -*jbnc- *** No CAPabilities available. ***
[03:37:45] -*jbnc- *** No CAPabilities available. ***

Wait a few seconds for it to make this error:

[03:38:16] Closing Link: [127.0.0.1] (Registration Timeout)
[03:38:16] * Disconnected
[03:38:17] * Connect cancelled

Immediately log in, and there is this error:

[03:39:09] * Connecting to 127.0.0.1 (8888)
[03:39:09] * [10053] Software caused connection abort
[03:39:09] * Disconnected

and :

C:\Users\Mcdo\Documents\GitHub\jbncdev\lib\ClientReconnect.js:22
        this.connection.buffers[socket.clientbuffer] = { data: '', connected: true, privmsgnotice: [] };
                                                     ^

TypeError: Cannot create property 'mobile' on boolean 'false'

Madriix avatar Apr 22 '24 01:04 Madriix

The error seems to be fixed. I've deployed it to production for tomorrow. I'll check if everything's okay : https://github.com/freenode/jbnc/pull/79/commits/a550d20ec9f3b70e5c3c07cdec44b909d0c3a025

Madriix avatar Apr 22 '24 03:04 Madriix

The error recurred last night, 3 times in 5 minutes, presumably by the same user. The error even triggered again this morning at 6:05 AM, where it seems to have occurred 5 times in 20 minutes, likely by the same user, but there's no certainty if it's the same user as yesterday.

The error resembles what I fixed here https://github.com/freenode/jbnc/pull/79 for the events 433 ERR_NICKNAMEINUSE and 451 ERR_NOTREGISTERED. It just requires placing a "connection end()" in the right place.

I'm not familiar with many events where "end()" would need to be placed, except for:

  • At the time of quit (/quit)
  • ERROR (kill etc.)
  • 433 ERR_NICKNAMEINUSE
  • 451 ERR_NOTREGISTERED
  • The "gone" with the settimeout()

It seems like "end()" should be placed in a location where the connection has been registered in the array, but in reality, the client disconnected before or couldn't establish the connection, yet it remains registered in the "array" without being able to connect to it.

The error could also occur due to something like:

  • Forbidden nickname
  • Error in /PASS (incorrect or missing)

It could also be a missing raw in jbnc.

Here's the current error:

1714449963 # Serious problem (uncaughtException) - this should not happen but the JBNC is still running. TypeError: Cannot create property 'mobile' on boolean 'false'
    at ClientReconnect.init (/home/debian/node/jbnc/lib/ClientReconnect.js:24:54)
    at new ClientReconnect (/home/debian/node/jbnc/lib/ClientReconnect.js:8:10)
    at Server.clientReconnect (/home/debian/node/jbnc/lib/Server.js:739:16)
    at TLSSocket.<anonymous> (/home/debian/node/jbnc/lib/Server.js:335:58)
    at TLSSocket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)

Madriix avatar Apr 30 '24 06:04 Madriix

The bug occurs when reproducing the following steps:

  1. Change the nickname (for example: Nick|AFK).
  2. Then, the user gets g-lined. The error occurs as soon as they attempt to reconnect. Furthermore, when trying to reconnect, it doesn't work immediately; they have to refresh the web page with the applet.

The bug does not occur if the person has reverted to their initial nickname, which is Nick before getting gline.

Madriix avatar May 12 '24 20:05 Madriix