CraZySacX / node-jdbc

JDBC Wrapper for node.js
140 stars 106 forks source link

node.js stuck on reserve #193

Open royigoldi opened 5 years ago

royigoldi commented 5 years ago

Hi,

when I tried to work with the jdbc to Apache Impala and the impala server stuck, also the node.js server stuck on reserve:

Pool.prototype.reserve = function(callback) { var self = this; var conn = null; self._closeIdleConnections();

if (self._pool.length > 0 ) { conn = self._pool.shift();

if (conn.lastIdle) {
  conn.lastIdle = new Date().getTime();
}

self._reserved.unshift(conn);

} else if (self._reserved.length < self._maxpoolsize) { try { conn = addConnectionSync(self._url, self._props, self._keepalive, self._maxidle); self._reserved.unshift(conn); } catch (err) { winston.error(err); conn = null; return callback(err); } }

I want to ask please, why you call to add connectionSync inside the reserve function beacuse the event loop are waiting to the connection and stay in stuck mode. it should be async!!!

Thanks a lot, Royi