Demo of the early exit when calling connection.end()
with a running query.
-
Install dependencies
yarn
-
Start & setup database with docker-compose
docker-compose up -d docker-compose exec mysql sh -c 'exec mysql -uroot -p"supersecret" < /sql/authors.sql'
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.
MYSQL_PASSWORD=supersecret node ./mysql-early-exit.js --process-results
Notice that Disconnected, THIS IS NEVER SHOWN
was printed to the console.