Skip to content

fix: discard connections after fatal query errors - #865

Open
IMRANDIL wants to merge 1 commit into
loopbackio:masterfrom
IMRANDIL:investigate/614-econnreset
Open

IMRANDIL wants to merge 1 commit into
loopbackio:masterfrom
IMRANDIL:investigate/614-econnreset

Conversation

@IMRANDIL

Copy link
Copy Markdown

A fatal query error can cause a queued request to receive an unusable connection. The connector releases the connection inside the query callback, before mysql2 emits the connection error event that removes it from the pool.

Destroy connections on fatal errors instead of releasing them. Nonfatal SQL errors continue to release reusable connections. The interrupted query still reports its original error; no retry is introduced.

Related to #614. This reproduces a failure relevant to that report, but does not establish the original reporter's exact conditions.

Validation

  • Added regression tests for queued-query recovery after a fatal error and connection reuse after a nonfatal SQL error.
  • Confirmed with a real TCP-reset proxy: before the fix, both the interrupted and waiting queries fail; afterward, the waiting query succeeds.
  • Transaction tests and new regression tests: 29 passing.
  • ESLint and whitespace checks pass.
  • Full suite after the initial regression test: 201 passing, with the same two pre-existing local failures:
    • URL test helper omits the configured port (local MySQL uses 3307).
    • Windows zero-date test expects acceptance, but the Docker MySQL server rejects zero dates in strict mode.

Signed-off-by: IMRANDIL <aliimranadil2@gmail.com>
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

Successfully merging this pull request may close these issues.

1 participant