Dropped connection from Postgres DB requires Stardog Server restart

I had a delay in querying Stardog and Postgres of about a half hour (had to take a call). Things were working. After the delay ... Studio (even after restart) is returning the error ...

000012: Unable to execute virtual graph query. SQL string: SELECT "xx", "yy", "zz"
FROM "schema"."tableName"
WHERE "zz" = 'ABC' AND "yy" = 'george'

stardog.log indicates that ...

WARN  2020-05-28 16:23:27,716 [stardog-user-16] com.complexible.stardog.protocols.http.server.StardogUndertowErrorHandler:accept(64): Unexpected exception was handled by the server
org.postgresql.util.PSQLException:  This connection has been closed.
at org.postgresql.jdbc.PgConnection.checkClosed(PgConnection.java:857) ~[postgresql-42.2.12.jar:42.2.12]
at org.postgresql.jdbc.PgConnection.createStatement(PgConnection.java:1756) ~[postgresql-42.2.12.jar:42.2.12]

I had to STOP the Stardog server and restart it to re-establish a connection. Then, things worked. I can't stop my Stardog server in production.



Sharing here ... I tried setting ext.ConnectionRetryCount to 3 and ext.ConnectionRetryDelay to 5 in Studio's driver settings, for the Postgres driver.

The query tried to run in Studio, but what originally took about 1.5 mins ended after 10 mins with the 00012 message.

So, that change did something but still was not successful.


A quick update. After I restarted Stardog with the failed query and VG config above, Stardog could not establish the VG connection.

I had to remove the ext.* settings and then everything worked.


To close this out .... We resolved this by setting Postgres' testOnBorrow and testWhileIdle TRUE, and setting timeBetweenEvictionRunsMillis to 2000.