Throw an error when a connection ends with a RST,ACK packet?
See original GitHub issueHi,
I’m using Azure MySQL database.
According to MySQL docs, COM_QUIT command should end with “either a connection close or a OK_Packet”.
It can be reproduced when you run this example code against an Azure MySQL instance.
var mysql = require('mysql2');
var connection = mysql.createConnection({ config });
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
if (error) throw error;
console.log('The solution is: ', results[0].solution);
});
connection.end();
Throws ECONNRESET
error.
Should this library throw an error when a connection end with a RST with the ACK flag set? Can we detect this?
I see mysqljs already fixed it at commit https://github.com/mysqljs/mysql/commit/9168ced54148721c8872ddab583116f00b4bc4f8 . But we prefer using mysql2 now and it block me. Could mysql2 fix it either?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Throw an error when a connection ends with a RST,ACK ...
According to MySQL docs, COM_QUIT command should end with "either a connection close or a OK_Packet". As @elemount pointed out in issue ...
Read more >Raise exception when TCP connection broken - Stack Overflow
Being at end of file is not intrinsically an error, nor is it normally understood to mean a "broken" connection like your title...
Read more >end{align} throws Package inputenc Error - TeX
Does somebody know why I get this error and how to fix it? There isn't even a "-" in the line "\end{align}"? Also,...
Read more >Error handling in R with tryCatchLog: Catching, logging, post ...
The call stack ends basically with the tryCatch call but does not show you the code line in f() where the error was...
Read more >Errors | Node.js v19.3.0 Documentation
It is used when catching an error and throwing a new one with a different message or code in order to still have...
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
probably fix should be here - https://github.com/sidorares/node-mysql2/blob/5c5aa3aed7e772e599dbefdafb04405672901808/lib/connection.js#L123
if already
_closing
, ignore error ( same way.end()
is expected when this flag set on line 94 )I used the code in the
_handleNetworkError
and now it works. I raised a pull request on it.