coopernurse / node-pool

Generic resource pooling for node.js
2.37k stars 259 forks source link

A promise was created in a handler but was not returned from it #251

Closed artursgirons closed 5 years ago

artursgirons commented 5 years ago

This started to show up when upgraded from 3.4.0 to 3.6.0. Using sequelize and this happens when calling connection.authenticate()

Warning: a promise was created in a handler at /workspace/node_modules/generic-pool/lib/Pool.js:319:14 but was not returned from it, see http://goo.gl/rRqMUw at Function.Promise.cast (/workspace/node_modules/bluebird/js/release/promise.js:196:13)

sandfox commented 5 years ago

Do you have an example or demo that I can use to reproduce this error?

eseliger commented 5 years ago

I think this happens in Pool._testOnBorrow

DiegoRBaquero commented 5 years ago

So it seems _dispense() is creating a promise but not returning it???

@eseliger where?

eseliger commented 5 years ago

I was thinking of this line: https://github.com/coopernurse/node-pool/blob/master/lib/Pool.js#L167 but its just a guess

sandfox commented 5 years ago

Ok, I'll see what I can work out about whats happening here

DiegoRBaquero commented 5 years ago

@eseliger It has its handler in line 170. But we should add a catch.

sandfox commented 5 years ago

Ah, I think it was most likely my removal of the return null in https://github.com/coopernurse/node-pool/commit/f5a93df86e58b2fd50e7f8c12c1c05c0a14b5572#diff-1b589a05fcf1509343500faf9cd70bdaL314

I did wonder why it was there to start with... now we know!

sandfox commented 5 years ago

fixed and published in v3.6.1