ECONNRESET when closing SSL connection not being handled to NodeJS Error spec
See original GitHub issueHi there, I receive the following error when closing a SSL connection that bubbles up:
{
errno: -4077,
code: "ECONNRESET",
syscall: "read",
stack:
"Error: read ECONNRESET\n at TLSWrap.onStreamRead (node:internal/stream_base_commons:220:20)\n at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17)",
message: "read ECONNRESET",
}
I’ve narrowed it down to the following lines that are mishandling the exception thrown:
// Line 160 of mysql2/lib/connection.js
_handleNetworkError(err) {
if (this.connectTimeout) {
Timers.clearTimeout(this.connectTimeout);
this.connectTimeout = null;
}
// Do not throw an error when a connection ends with a RST,ACK packet
if (err.errno === 'ECONNRESET' && this._closing) {
return;
}
this._handleFatalError(err);
}
Issue seems to be that it’s looking for err.errno
as a string. However, errno
has exclusively been a negative number since Node 13, with err.code
being the string that would emit ECONNRESET
.
I see that this has been fixed in master. Can this please be released to npm?
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How do I debug error ECONNRESET in Node.js?
"ECONNRESET" means the other side of the TCP conversation abruptly closed its end of the connection. This is most probably due to one...
Read more >0.10.x https/ssl and ECONNRESET error (part 2) #5360 - GitHub
ECONNRESET means the other end unexpectedly closed the connection but that's the 'what', not the 'why'. Can you post a test case?
Read more >Errors | Node.js v19.3.0 Documentation
Indicates that an attempt is being made to access a variable that is not defined. Such errors commonly indicate typos in code, or...
Read more >Nodejs HTTPS ECONNRESET ~ Ozkary
The https library in Nodejs enables us to make https calls to APIs under SSL/TLS protocols (encrypted channels).
Read more >openssl enable legacy provider | The search engine you control.
Due to changes on Node.js v17, --openssl-legacy-provider was added for handling key size on OpenSSL v3. You somehow have installed the latest version...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That looks useful. I’ll have to look into it further. Thanks for the heads up!
@sidorares Will this be pushed to NPM? At present I am having to patch the repo via
yarn patch
in the meantime.