pg-promise: Stack overflow when losing SSH tunneling connections

Hello there,

First of all I have to say this is a great library. Really neat and well maintained!

I think I have encountered a serious problem related to losing an established connection with a DB.

If the application using pg-promise successfully connects to a DB but then the physical connection ceases to exist (e.g. unexpected truncation of ssh tunnel), pg-promise will trigger an apparent-infinite call recursion to getSafeConnection which will result in a RangeError: Maximum call stack size exceeded.

I am not sure there is anything I can do to catch this error as it is quite low-level inside the guts of pg-promise, but perhaps scheduling the next call to getSafeConnection without blocking the event loop could solve this.

Thank you so much for your time!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (12 by maintainers)

Most upvoted comments

@lzambarda Thank you for returning this!

Hello, I finally managed to test this using the same code described in this discussion using Release 8.7.2 (it installed automatically when adding the dependancy). It seems to be working fine now, thanks for the great support!