PSA: If you're on node `20.0.0` and above, and want to use this library with `client.configuration.connection.secure === true`, use the argument `--no-network-family-autoselection`
brian6932 opened this issue · 22 comments
Connecting over ws is unaffected
This is relatively rare now, but eventually, you'll get the following error:
node:internal/assert:14
throw new ERR_INTERNAL_ASSERTION(message);
^
NotSpecified: (:) [], RemoteException
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
NotSpecified: (:) [], RemoteException
at new NodeError (node:internal/errors:399:5)
at assert (node:internal/assert:14:11)
at internalConnectMultiple (node:net:1107:3)
at Timeout.internalConnectMultipleTimeout (node:net:1638:3)
at listOnTimeout (node:internal/timers:575:11)
at process.processTimers (node:internal/timers:514:7) {
code: 'ERR_INTERNAL_ASSERTION'
}
NotSpecified: (:) [], RemoteException
Node.js v20.2.0
Ok, I've looked into this issue a bit more, and it seems to only occur when
client.configuration.connection.secure === true && client.configuration.connection.method === `tcp`
If you make a very smol connection to tmi over tcp:
import { connect } from 'net'
const xd = connect(6667, `irc.chat.twitch.tv`, () => console.log(`connected`))
xd
.setEncoding(`utf8`)
.setNoDelay()
.on(`connect`, () => xd.write(`nick justinfan123\njoin #tmiloadtesting2\n`))
.on(`data`, _ => console.log(_))
It doesn't exhibit the issue either
Oddly enough, doing the same thing securely is working fine for me
import { TLSSocket } from 'tls'
const xd = new TLSSocket()
.connect(6697, `irc.chat.twitch.tv`, () => console.log(`connected`))
xd
.setEncoding(`utf8`)
.setNoDelay()
.on(`connect`, () => xd.write(`nick justinfan123\njoin #tmiloadtesting2\n`))
.on(`data`, _ => console.log(_))
@brian6932 To clarify, does 20.3.0 still result in the same ERR_INTERNAL_ASSERTION
error, or in a different error? Could you post the stack trace (including the Node.js version at the bottom) for Node.js 20.3.0, please?
yes
node:internal/assert:14
throw new ERR_INTERNAL_ASSERTION(message);
^
NotSpecified: (:) [], RemoteException
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
NotSpecified: (:) [], RemoteException
at new NodeError (node:internal/errors:405:5)
at assert (node:internal/assert:14:11)
at internalConnectMultiple (node:net:1106:3)
at Timeout.internalConnectMultipleTimeout (node:net:1644:3)
at listOnTimeout (node:internal/timers:575:11)
at process.processTimers (node:internal/timers:514:7) {
code: 'ERR_INTERNAL_ASSERTION'
}
NotSpecified: (:) [], RemoteException
Node.js v20.3.0
@brian6932 I cannot reproduce this on Node.js 20.3.0.
Can you please post the result of dig irc.chat.twitch.tv
here?
; <<>> DiG 9.16.41 <<>> irc.chat.twitch.tv
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57154
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;irc.chat.twitch.tv. IN A
;; ANSWER SECTION:
irc.chat.twitch.tv. 148 IN A 44.227.173.36
irc.chat.twitch.tv. 148 IN A 34.212.92.60
irc.chat.twitch.tv. 148 IN A 44.237.40.50
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Jun 13 10:09:54 Eastern Daylight Time 2023
;; MSG SIZE rcvd: 138
Ok, another question: can you please provide the entire file (or a meaningful repro) that you're trying to execute?
@ShogunPanda https://github.com/pajlada/brian-test-repro You can use this
Ok, I've looked into this issue a bit more, and it seems to only occur when
client.configuration.connection.secure === true && client.configuration.connection.method === `tcp`
As explained here, if secure is true (default), and tcp is the method (default), it will produce the error
A more minimal example
// index.mjs
import { Socket } from "net";
import { TLSSocket } from "tls";
const port = 6697;
const host = "irc.chat.twitch.tv";
const backingSocket = new Socket();
const stream = new TLSSocket(backingSocket);
backingSocket.connect(port, host);
stream.connect(port, host);
then node index.mjs
- no library dependencies needed
Host and port can be changed too and it still happens. I tested with port set to 443
and host set to httpbin.org
And confirmed it works with node --no-network-family-autoselection index.mjs
Hello!
I was able to reproduce this and I have a PR coming soon for node. It will probably be included in 20.4.0
and 18.17.0
.
Hello. The fix for this is in the PR above.
I'll let you know once it lands so you can try a nightly build to see if it solves your issue.
Seems fixed in 20.4.0
@ShogunPanda I have once again received this error. My internet connection at the moment is pretty messed up, so things are timing out, and I suspect that this error is actually taking the place of a socket timeout error.
node:internal/assert:14
throw new ERR_INTERNAL_ASSERTION(message);
^
NotSpecified: (:) [], RemoteException
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
NotSpecified: (:) [], RemoteException
at assert (node:internal/assert:14:11)
at internalConnectMultiple (node:net:1118:3)
at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
at listOnTimeout (node:internal/timers:575:11)
at process.processTimers (node:internal/timers:514:7) {
code: 'ERR_INTERNAL_ASSERTION'
}
❯ node --version
v21.1.0
@brian6932 Were you connecting via TLS or just plain socket?
@brian6932 Were you using TLS?
I was using a WebSocket over TLS @ShogunPanda
Configuration
client.configuration.connection.secure === true && client.configuration.connection.type === `websocket`
Amazing, I have a lead then. I'll try to see what I can do. Thanks sir!
I have received this multiple times today, and can't blame my internet this time around
node:internal/assert:14
throw new ERR_INTERNAL_ASSERTION(message);
^
NotSpecified: (:) [], RemoteException
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
NotSpecified: (:) [], RemoteException
at assert (node:internal/assert:14:11)
at internalConnectMultiple (node:net:1118:3)
at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
at listOnTimeout (node:internal/timers:575:11)
at process.processTimers (node:internal/timers:514:7) {
code: 'ERR_INTERNAL_ASSERTION'
}
NotSpecified: (:) [], RemoteException
Node.js v21.1.0
@brian6932 which hosts were you connecting to? How are they resolved from the source host (in other words, can you please post the results of a DNS query from the source host?)
I don't need them to be real data, but I just need to understand the DNS configuration.
@ShogunPanda like a dig?
❯ dig irc-ws.chat.twitch.tv
; <<>> DiG 9.16.44 <<>> irc-ws.chat.twitch.tv
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11876
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;irc-ws.chat.twitch.tv. IN A
;; ANSWER SECTION:
irc-ws.chat.twitch.tv. 178 IN A 54.149.99.139
irc-ws.chat.twitch.tv. 178 IN A 35.81.35.127
irc-ws.chat.twitch.tv. 178 IN A 54.68.6.240
irc-ws.chat.twitch.tv. 178 IN A 52.34.153.17
irc-ws.chat.twitch.tv. 178 IN A 54.213.60.189
irc-ws.chat.twitch.tv. 178 IN A 54.213.129.174
irc-ws.chat.twitch.tv. 178 IN A 52.25.250.105
irc-ws.chat.twitch.tv. 178 IN A 54.200.131.254
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Nov 11 14:19:52 Eastern Standard Time 2023
;; MSG SIZE rcvd: 346
Yes, exactly. Thanks, I'll look it up!
@ShogunPanda Looks like I've gotten it with
client.configuration.connection.secure === true && client.configuration.connection.type === `tcp`
as well this time.
stack
node:internal/assert:14
throw new ERR_INTERNAL_ASSERTION(message);
^
NotSpecified: (:) [], RemoteException
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
NotSpecified: (:) [], RemoteException
at assert (node:internal/assert:14:11)
at internalConnectMultiple (node:net:1118:3)
at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
at listOnTimeout (node:internal/timers:575:11)
at process.processTimers (node:internal/timers:514:7) {
code: 'ERR_INTERNAL_ASSERTION'
}
NotSpecified: (:) [], RemoteException
Node.js v21.4.0
So I'll reopen this issue, but make it more general, and say that it's pretty rare. dig for tcp
instead of ws
.
❯ dig irc.chat.twitch.tv
; <<>> DiG 9.16.45 <<>> irc.chat.twitch.tv
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58093
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;irc.chat.twitch.tv. IN A
;; ANSWER SECTION:
irc.chat.twitch.tv. 300 IN A 44.227.173.36
irc.chat.twitch.tv. 300 IN A 34.212.92.60
irc.chat.twitch.tv. 300 IN A 44.237.40.50
;; Query time: 14 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Dec 13 10:45:23 Eastern Standard Time 2023
;; MSG SIZE rcvd: 149
Thanks!
In the meanwhile I created nodejs/node#51045 which should finally fix this issue once for all.
I'll keep you posted on this!