After we setup PostgreSQL server with SSL certificates we get this error very often. This happens on the flows with a lot of interaction with the database(update a lot of entries/insert)
HikariPool-1 - Connection marked as broken because of SQLSTATE(08006), ErrorCode(0)
j.n.SocketException: Connection reset by peer (Write failed)
at j.n.SocketOutputStream.socketWrite0(SocketOutputStream.java)
at j.n.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
at j.n.SocketOutputStream.write(SocketOutpu`enter code here`tStream.java:150)
at s.s.s.SSLSocketOutputRecord.deliver(SSLSocketOutputRecord.java:320)
at s.s.s.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:983)
... 63 common frames omitted
Wrapped by: j.n.s.SSLProtocolException: Connection reset by peer (Write failed)
at s.security.ssl.Alert.createSSLException(Alert.java:126)
at s.s.s.TransportContext.fatal(TransportContext.java:321)
at s.s.s.TransportContext.fatal(TransportContext.java:264)
at s.s.s.TransportContext.fatal(TransportContext.java:259)
at s.s.s.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:988)
at j.i.BufferedOutputStream.write(BufferedOutputStream.java:123)
at j.i.FilterOutputStream.write(FilterOutputStream.java:108)
at o.p.core.PGStream.send(PGStream.java:252)
at o.p.c.v.QueryExecutorImpl.sendParse(QueryExecutorImpl.java:1440)
at o.p.c.v.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1767)
at o.p.c.v.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1328)
at o.p.c.v.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
... 56 common frames omitted
Wrapped by: o.p.u.PSQLException: An I/O error occurred while sending to the backend
I was able to solve this issue by adding below properties:
spring.datasource.test-while-idle=true
spring.datasource.validation-query=SELECT 1;
spring.datasource.time-between-eviction-runs-millis=60000
spring.datasource.hikari.idle-timeout=600000
spring.datasource.hikari.validationTimeout=300000
spring.datasource.remove-abandoned=true
spring.datasource.remove-abandoned-timeout=60
spring.datasource.hikari.connectionTimeout=30000
spring.datasource.hikari.idleTimeout=600000
spring.datasource.hikari.maxLifetime=1800000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With