balderdashy / balderdashy/sails

Sails failed to lower / process does not exit - cannot destroy mysql connection pool

Open
#4,583 2 comments 0 reactions 0 assignees View on GitHub
more info please orm
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Sails version**: 1.1.0
**Node version**: 10.15.0
**NPM version**: 6.7.0
**DB adapter name**: sails-mysql
**DB adapter version**: 1.0.1
**Operating system**: mac os 10.14


When calling sails.lower(); the process is getting stuck in a loop trying to destroy the MySQL connection pool. Im not sure what could be causing this, any Ideas would be extremely helpful.

> 2019-02-06T22:47:38.659Z - error: Could not tear down the ORM hook. Error details: {"message":"There was an error destroying the connection manager.\n\nException:` destroyManager` failed (\"failed\"). Could not destroy the provided connection manager.\nAdditional data:\n\n{ error:\n Error: Failed to destroy the MySQL connection pool and/or gracefully end all connections in the pool. Details:\n === === ===\n Error: Quit inactivity timeout\n at Quit. (/Project/node_modules/mysql/lib/protocol/Protocol.js:164:17)\n at Quit.emit (events.js:182:13)\n at Quit.EventEmitter.emit (domain.js:441:20)\n at Quit._onTimeout (/Project/node_modules/mysql/lib/protocol/sequences/Sequence.js:129:8)\n at ontimeout (timers.js:436:11)\n at tryOnTimeout (timers.js:300:5)\n at listOnTimeout (timers.js:263:5)\n at Timer.processTimers (timers.js:223:10)\n --------------------\n at Protocol._enqueue (/Project/node_modules/mysql/lib/protocol/Protocol.js:145:48)\n at Protocol.quit (/Project/node_modules/mysql/lib/protocol/Protocol.js:92:23)\n at PoolConnection.end (/Project/node_modules/mysql/lib/Connection.js:249:18)\n at Pool._purgeConnection (/Project/node_modules/mysql/lib/Pool.js:261:16)\n at Pool.end (/Project/node_modules/mysql/lib/Pool.js:182:10)\n at Object.destroyManager (/Project/node_modules/machinepack-mysql/lib/destroy-manager.js:73:25)\n at wrapper (/Project/node_modules/@sailshq/lodash/lib/index.js:3275:19)\n at Deferred.parley.retry [as _handleExec] (/Project/node_modules/machinepack-mysql/node_modules/machine/lib/private/help-build-machine.js:1076:19)\n at Deferred.exec (/Project/node_modules/parley/lib/private/Deferred.js:286:10)\n at Object.destroyManager (/Project/node_modules/sails-mysql/helpers/private/connection/destroy-manager.js:23:4)\n at Object.teardown (/Project/node_modules/sails-mysql/helpers/teardown.js:73:24)\n

```
"use strict";

var sails = require('sails');

sails.lift({
log: { level: 'silly' }
}, (err) => {
if (err) throw err;
console.log("Sails Lifted");
sails.lower();
});
```

Contributor guide

Open the contributing guide

Research direction

Start with the reproduced sails.lift() callback and sails.lower() call, then trace the teardown stack through sails-mysql/helpers/teardown.js and sails-mysql/helpers/private/connection/destroy-manager.js into machinepack-mysql/lib/destroy-manager.js. Reproduce the Quit inactivity timeout and verify that lowering the lifted app destroys the MySQL pool and lets the process exit.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mysql, node.js
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.