question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception on ConnectionPool release

See original GitHub issue

I’m getting a uncaught exception since I upgraded to v4. I couldn’t pinpoint from the stack trace (below) when/where exactly it’s happening.

Except for the v3 to v4 migration, I didn’t change anything else in my code.

TypeError: Cannot read property 'release' of null
    at ConnectionPool.release (/app/node_modules/mssql/lib/base.js:199:14)
    at Request.tds.Request.err [as userCallback] (/app/node_modules/mssql/lib/tedious.js:608:25)
    at Request._this.callback (/app/node_modules/tedious/lib/request.js:47:27)
    at Connection.message (/app/node_modules/tedious/lib/connection.js:1401:27)
    at Connection.dispatchEvent (/app/node_modules/tedious/lib/connection.js:687:45)
    at MessageIO.<anonymous> (/app/node_modules/tedious/lib/connection.js:602:18)
    at emitNone (events.js:86:13)
    at MessageIO.emit (events.js:186:7)
    at ReadablePacketStream.<anonymous> (/app/node_modules/tedious/lib/message-io.js:102:16)
    at emitOne (events.js:96:13)
    at ReadablePacketStream.emit (events.js:189:7)

Hope you’ll be able to help, thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:18

github_iconTop GitHub Comments

7reactions
mwardlecommented, Jun 30, 2017

I am having the same issue.

TypeError: Cannot read property 'release' of null
    at ConnectionPool.release (/var/app/current/node_modules/mssql/lib/base.js:199:14)
    at Request.tds.Request.err [as userCallback] (/var/app/current/node_modules/mssql/lib/tedious.js:608:25)
    at Request._this.callback (/var/app/current/node_modules/tedious/lib/request.js:47:27)
    at Connection.message (/var/app/current/node_modules/tedious/lib/connection.js:1401:27)
    at Connection.dispatchEvent (/var/app/current/node_modules/tedious/lib/connection.js:687:45)
    at MessageIO.<anonymous> (/var/app/current/node_modules/tedious/lib/connection.js:602:18)
    at emitNone (events.js:86:13)
    at MessageIO.emit (events.js:185:7)
    at ReadablePacketStream.<anonymous> (/var/app/current/node_modules/tedious/lib/message-io.js:102:16)
    at emitOne (events.js:96:13)
    at ReadablePacketStream.emit (events.js:188:7)
5reactions
pierre-eliecommented, Jan 18, 2018

I’m testing the following to bypass the error, so far so good:

const connection = new mssql.ConnectionPool(...);

// Patch for https://github.com/patriksimek/node-mssql/issues/467
connection._throwingClose = connection._close;
connection._close = function(callback) {
  const close = connection._throwingClose.bind(this, callback);
  if (this.pool) {
    return this.pool.drain().then(close);
  }
  else {
    return close();
  }
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Do I need to release a connection if I throw an error?
So if I get a connection pool, then something unexpected happens and the error will be thrown, do I need to additionally release...
Read more >
Connection pool (Version 4) settings - IBM
If the application tries to use the connection again, it is issued a stale connection exception. Connections that are enlisted in a transaction ......
Read more >
A Simple Guide to Connection Pooling in Java - Baeldung
A quick overview of several popular connection pooling solutions, plus a quick dive into a custom connection pool implementation.
Read more >
SQL Server Connection Pooling - ADO.NET - Microsoft Learn
The connection pooler satisfies requests for connections by reallocating connections as they are released back into the pool. If the maximum ...
Read more >
Exception at getConnection from pool - Oracle Communities
looks like you're trying retrieve a connection that is already established... did you write the ConnectionPool class yourself? or did you use API...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found