Skip to content
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

Disconnect event not caught #195

Closed
Galienna opened this issue Mar 15, 2022 · 2 comments
Closed

Disconnect event not caught #195

Galienna opened this issue Mar 15, 2022 · 2 comments

Comments

@Galienna
Copy link

Hi,

The 3.0.0 release seems to have introduced a bug that wasn't there in 2.5.6.

Scenario

  • Using the promise API
  • Create a connection pool
  • Get a connection
  • Perform some requests
  • Release connection
  • Shutdown the DB server
  • Error ER_CONNECTION_KILLED is sometimes caught in the error event of the connection, sometimes not
  • Error ER_SOCKET_UNEXPECTED_CLOSE is sometimes caught in the error event of the connection, sometimes not
  • One more ER_SOCKET_UNEXPECTED_CLOSE is raised but I'm unable to catch it, thus my node process crashes. It doesn't get caught by the error event handler that I added to the connection.

Exact same code and scenario works fine with 2.5.6

Good luck and thank you for the lib :)

@rusher
Copy link
Collaborator

rusher commented Jun 13, 2022

i'm trying to reproduced the problem without success. Do you have any additional information ?
could you confirm that those event are set with poll 'connection' event, then connection 'error' event ? something like :

pool.on('connection', conn => {
      conn.on('error', (err) => {
        console.log(`connection ${conn.threadId} error `);
        console.log(err);
      })
    });

rusher added a commit that referenced this issue Jul 1, 2022
In 3.0, when releasing connection to pool not with connection.release() but connection.close(), connection wasn't given back to pool, but killed.
When killing connection, server send a ER_CONNECTION_KILLED error that can sometime be caught by connector before socket is closed, but that's not assured, then having just an ER_SOCKET_UNEXPECTED_CLOSE error.
@rusher
Copy link
Collaborator

rusher commented Jul 1, 2022

corrected with https://jira.mariadb.org/browse/CONJS-196. Will be part of 3.0.1 release

@rusher rusher closed this as completed Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants