Peter Coppens
Peter Coppens

Reputation: 121

Play-Scala-Slick hangs up

Using the following versions to implement a Play/REST/PostgreSQL service in Scala

scalaVersion: "2.12.8"
playVersion: "2.7.3"
playSlickVersion: "4.0.2"

When putting load on the server it eventually locks on database access. All the database connection pool connections when looked at from the postgres side (pg_stat_activity) are all reported "idle in transaction" and all show the last query that was (or is being) executed.

Hikari logging repeatedly shows stats like

2021-02-26 19:04:25,383 [debug] [db housekeeper] [c.z.h.p.HikariPool] db - Pool stats (total=20, active=20, idle=0, waiting=0)
2021-02-26 19:04:25,383 [debug] [db housekeeper] [c.z.h.p.HikariPool] db - Fill pool skipped, pool is at sufficient level.

The weird thing is that when I configure the db connection pool such that the queueSize is smaller than numThreads it does not lock up. It does give RejectedExecutionException from slick.util.AsyncExecutor in such configuration but at least is does not hang.

Anyone any idea how this lock up can be explained and how does making queueSize smaller than numThreads avoids the issue?

All tips warmly welcomed.

Tx!

Peter

Upvotes: 0

Views: 209

Answers (1)

Peter Coppens
Peter Coppens

Reputation: 121

It proofed to be a case of what is described in https://github.com/playframework/play-slick/issues/445#issuecomment-625602447

After avoiding the constructs described in the above issue, all is working out fine now.

Upvotes: 0

Related Questions