Skip to content

after a while, callbacks are not called on broken connection #400

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

Closed
rainbow-alex opened this issue Feb 25, 2013 · 0 comments
Closed

after a while, callbacks are not called on broken connection #400

rainbow-alex opened this issue Feb 25, 2013 · 0 comments
Milestone

Comments

@rainbow-alex
Copy link

Access denied errors (and possibly others) stop callbacks from being called, but only after some time has passed. That is:

expected: When connecting badly, the first query calls back with an error.
expected: If I query again (within the same stack frame), the callback gets an error.
expected: If I query again (soon, in a different stack frame), the callback gets an error.
unexpected: If I query yet again (some time later, in a different stack frame), the callback is never called.

Here is a simple script illustrating the problem. Note that the connection options are supposed to be nonsense, to cause the access denied error.

"use strict";

let mysql = require( "mysql" );

let db = mysql.createConnection( {
    user: "foo",
    database: "bar",
} );

function oops()
{
    db.query( "SELECT 1",
    function( err, v )
    {
        console.log( "error is", err );
    } );
}

oops();
oops();
process.nextTick( oops );
setTimeout( oops, 200 );

expected: 4x access denied
actual: 3x access denied

@dougwilson dougwilson added this to the 2.2 milestone Apr 8, 2014
dveeden pushed a commit to dveeden/mysql that referenced this issue Jan 31, 2023
Use Errorf instead of Error in the correct places
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants