sidorares / sidorares/node-mysql2

Connection.end() never called back when there's an error

Open
#922 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.4k
Forks
680
Avg merge
9h 7m
Merged PRs (30d)
59

Description

https://github.com/sidorares/node-mysql2/blob/821b2bcdc254c483e6879b5d4afc9757c55c7ed7/lib/commands/quit.js#L10

Inside quit.js

this.done = callback;

should probably be

this.onResult = callback;

!? 🤔

How to repeat:

Make a connection, that fails.

call connection.end(callback)

expected: Expected callback to be called

what actually happends: callback is never called.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/commands/quit.js at the callback assignment around line 10, then trace how Connection.end() handles a failed connection. Reproduce the reported case and verify that the callback is invoked when the connection fails; done means the callback is called instead of being left pending.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, node.js, typescript
Domain
backend, database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.