Skip to content

Demo of the early exit when calling `connection.end()` with a running query.

Notifications You must be signed in to change notification settings

pmctire/mysql-abrupt-exit

Repository files navigation

Node MySQL Early Exit

Demo of the early exit when calling connection.end() with a running query.

Setup

  1. Install dependencies

    yarn
  2. Start & setup database with docker-compose

    docker-compose up -d
    docker-compose exec mysql sh -c 'exec mysql -uroot -p"supersecret" < /sql/authors.sql'

Problem behavior

MYSQL_PASSWORD=supersecret node ./mysql-early-exit.js --no-process-results

Notice you never see Disconnected, THIS IS NEVER SHOWN printed to the console. The last line of the code prints this message. Somehow it's skipped. It seems like something is calling exit(0) behind the scenes when there are leftover open streams during a disconnect.

Expected Behaviour

MYSQL_PASSWORD=supersecret node ./mysql-early-exit.js --process-results

Notice that Disconnected, THIS IS NEVER SHOWN was printed to the console.

About

Demo of the early exit when calling `connection.end()` with a running query.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published