ergoplatform / ergoplatform/explorer-backend

postgresql connections not closing

Open
#77 2 comments 0 reactions 1 assignee Claimed by @oskin1 View on GitHub
Dominant language
Scala
Stars
23
Forks
37
PR merge metrics
No merged PRs in 30d

Description

We are seeing a problem with postgresql connections not closing when using the latest release `3.2.1`.

```
org.postgresql.util.PSQLException: ERROR: canceling statement due to user request
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2533)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2268)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:313)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:448)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:369)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:159)
at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:109)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at doobie.free.KleisliInterpreter$PreparedStatementInterpreter.$anonfun$executeQuery$2(kleisliinterpreter.scala:956)
at doobie.free.KleisliInterpreter.$anonfun$primitive$2(kleisliinterpreter.scala:112)
at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:81)
at monix.eval.internal.TaskRunLoop$.$anonfun$restartAsync$1(TaskRunLoop.scala:222)
at cats.effect.internals.PoolUtils$$anon$2$$anon$3.run(PoolUtils.scala:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
```

It might be specific to following query, I did not reproduce the issue otherwise.

```
28646] STATEMENT:
select coalesce(cast(sum(o.value) as bigint), 0) from node_outputs o
left join (select i.box_id, i.main_chain from node_inputs i where i.main_chain = true) as i on o.box_id = i.box_id
left join node_transactions tx on tx.id = o.tx_id
where o.main_chain = true
and tx.inclusion_height <= $1
and (i.box_id is null or i.main_chain = false)
and o.ergo_tree = $2
```

Please note we do have autocommited enabled on the database, so I'm not sure why we are seeing this so often.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.