speckle-server icon indicating copy to clipboard operation
speckle-server copied to clipboard

Database connections stuck

Open gjedlicska opened this issue 2 years ago • 6 comments

After some time, some of the available database connections get stuck and they are never freed. This causes the preview service to stop functioning (a stopgap measure to revert to node14 was put in place) But its also causing performance degradation on the server too.

gjedlicska avatar May 12 '22 14:05 gjedlicska

I encountered this a few times recently and put it down to user error with making funky commits. Both things may be true.

jsdbroughton avatar May 15 '22 13:05 jsdbroughton

Which symptom have you noticed @jsdbroughton ?

gjedlicska avatar May 20 '22 09:05 gjedlicska

This causes the preview service to stop functioning

Which symptom have you noticed @jsdbroughton ?

Specifically, the previews are generated for some commits and not others. I only notice as I am using the embedded viewer. Whether the viewer has a preview or not is not a huge issue, but it has been inconsistent.

jsdbroughton avatar Jun 06 '22 13:06 jsdbroughton

fixed in #805

gjedlicska avatar Jun 17 '22 08:06 gjedlicska

Lets try with rewriting the SQL query without WHERE IN

gjedlicska avatar Aug 02 '22 08:08 gjedlicska

next steps to try:

  • [ ] not use WHERE IN for sql query in get object and children
  • [ ] sdk-s are sending the requests with get these child objects for me, that are in this list. There is possibly a better solution with cursors or smthing
  • [ ] properly close node pg query streams, in here, the added extra streams are probably not closed, when a connection is terminated https://github.com/specklesystems/speckle-server/blob/main/packages/server/modules/core/rest/diffDownload.js#L66

gjedlicska avatar Oct 24 '22 15:10 gjedlicska