Application hangs after some time if it is idle

I am calling login method using slick , it works normal , but after some time delay , it gets hanged it is not sending any response

if i am using logger , i am getting like this:

[debug] a.a.RepointableActorRef - Aborting tcp connection to /0:0:0:0:0:0:0:1:51838 because of upstream failure: akka.http.impl.engine.HttpIdleTimeoutEx
ception: HTTP idle-timeout encountered, no bytes passed in the last 75000000000 nanoseconds. This is configurable by akka.http.[server|client].idle-time

Can anyone help me in solving this problem

Thank you

Now i am getting error like this

 The connection is closed.
        at com.zaxxer.hikari.pool.PoolBase.setNetworkTimeout(
        at com.zaxxer.hikari.pool.PoolBase.quietlyCloseConnection(
        at com.zaxxer.hikari.pool.HikariPool$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$ Source)
        at Source)

Are you setting connection idle or timeout values for your DB connections? I ran into something similar with MongoDB where the hosted MongoDB service will automatically close the socket on their end after a few minutes of inactivity, which would cause errors on the application’s end, as it still thinks the connections are open (or something to that effect). Once I added connection timeout and idle settings, the errors went away.

My db config is like this


val dbConfig: DatabaseConfig[JdbcProfile] = DatabaseConfig.forConfig(“sql”)
val db: JdbcProfile#Backend#Database = dbConfig.db

I am not familiar with SQL Server, does it have any special flags for timeouts, disconnect/reconnect in its connection string? e.g. I know MySQL has something like that called autoReconnect=true in its connection string.

Even after using autoReconnect=true , it is not sending response for few requests ,

it is not sending response , sometimes after 10 min or sometimes after 2 hrs , and for the next immediate request it will be working fine

Now i am getting error like this

SQLTransientConnectionException: sqlserver.db - Connection is not available, request timed out after 21685ms.]

Hum, it is possible that:

  1. You have a connection leak. Are you accessing the connection manually and not releasing it? Try to configure HikariCP’s leakDetectionThreshold to confirm that.
  2. Your thread pool configuration for Slick is not consistent with your database connection pool. See Slick docs here.


Thank you @chrono_b and @marcospereira

Error got solved by giving

maxLifeTime < idleTimeOut