Skip to content

Connections are not automatically closed #8468

@Vadskye

Description

@Vadskye

What are you doing?

Assume $DATABASE_URL points to a real Postgres database.

const Sequelize = require('sequelize');

function main() {
  const sequelize = new Sequelize(
    process.env.DATABASE_URL,
    {dialect: 'postgres', operatorsAliases: false}
  );

  return sequelize.query(`select 1`);
}

main();

Full environment details and demo available at https://github.com/Vadskye/demo-sequelize.

What do you expect to happen?

The script should finish its execution 10 seconds after the query finishes, when the connection times out and all active connections have been closed. This was the behavior with Sequelize v3.

What is actually happening?

The script hangs indefinitely after the query finishes.

Script output with DEBUG=* sequelize:pool pool created with max/min: 5/0, no replication +0ms

sequelize:connection:pg connection acquired +0ms
sequelize:sql:pg executing(default) : SHOW SERVER_VERSION +0ms
sequelize:sql:pg executed(default) : SHOW SERVER_VERSION +1ms
sequelize:connection:pg connection timeout +20ms
sequelize:connection:pg connection acquired +4ms
sequelize:pool connection acquired +62ms
Executing (default): select 1
sequelize:sql:pg executing(default) : select 1 +27ms
sequelize:sql:pg executed(default) : select 1 +1ms
sequelize:pool connection released +6ms
sequelize:connection:pg connection timeout +10s
sequelize:pool connection destroy +10s

Dialect: postgres
Dialect version: 6.4.2
Database version: 9.4
Sequelize version: 4.13.8
Tested with master branch: No; there is one commit to master since the last release, and it does not affect this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: in discussionFor issues and PRs. Community and maintainers are discussing the applicability of the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions