Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection leak #70

Closed
monktastic opened this issue Sep 2, 2016 · 4 comments
Closed

Connection leak #70

monktastic opened this issue Sep 2, 2016 · 4 comments
Assignees

Comments

@monktastic
Copy link
Contributor

Howdy,

I'm getting the below stack trace:

[warn] 17:43:57.131 ProxyLeakTask  - Connection leak detection triggered for conn147: url=jdbc:h2:file:./var/project/h2-journal/h2:journal user=ROOT, stack trace follows
java.lang.Exception: Apparent connection leak detected
    at slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:12)
    at slick.jdbc.JdbcBackend$BaseSession.conn$lzycompute(JdbcBackend.scala:415)
    at slick.jdbc.JdbcBackend$BaseSession.conn(JdbcBackend.scala:414)
    at slick.jdbc.JdbcBackend$SessionDef$class.prepareStatement(JdbcBackend.scala:297)
    at slick.jdbc.JdbcBackend$BaseSession.prepareStatement(JdbcBackend.scala:407)
    at slick.jdbc.StatementInvoker.results(StatementInvoker.scala:33)
    at slick.jdbc.StatementInvoker.iteratorTo(StatementInvoker.scala:22)
    at slick.jdbc.StreamingInvokerAction$class.emitStream(StreamingInvokerAction.scala:28)
    at slick.driver.JdbcActionComponent$QueryActionExtensionMethodsImpl$$anon$1.emitStream(JdbcActionComponent.scala:218)
    at slick.driver.JdbcActionComponent$QueryActionExtensionMethodsImpl$$anon$1.emitStream(JdbcActionComponent.scala:218)
    at slick.backend.DatabaseComponent$DatabaseDef$$anon$3.run(DatabaseComponent.scala:285)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

I'm using Slick 3.1.1, HikariCP 2.4.7, akka 2.4.9, h2 1.4.192.

Any advice? I don't think I'm doing anything unusual, and I don't touch slick or HikariCP directly.

Thanks!

@monktastic
Copy link
Contributor Author

monktastic commented Sep 2, 2016

Ah @dnvriend, just noticed another issue where you suggest using HikariCP 2.3.13. Didn't work for them but maybe it will for us....

@monktastic
Copy link
Contributor Author

Did not fix it.

@monktastic
Copy link
Contributor Author

FYI I increased max connections and threads and the problem has not appeared for a while. Not sure if I just pushed it back. Let's see :)

@dnvriend
Copy link
Contributor

dnvriend commented Sep 3, 2016

Hi, darn the "connection leak" problem is back. This problem seems to arise when the max number of connections and threads have been set to a low setting. We came across this same problem in Issue #44 Leaking Connections. @prettynatty had this same issue and increased the queue size to 10000 and that seems to work for him.

For my own projects, I set the values to:

jdbc-journal {
slick.db.numThreads = 1000
slick.db.maxConnections = 25
slick.db.minConnections = 2
slick.db.initializationFailFast = false
}

jdbc-snapshot-store {
  slick.db.numThreads = 1000
  slick.db.maxConnections = 5
  slick.db.minConnections = 2
  slick.db.initializationFailFast = false
}

jdbc-read-journal {
  slick.db.numThreads = 1000
  slick.db.maxConnections = 5
  slick.db.minConnections = 2
  slick.db.initializationFailFast = false
}

which seems to work as well.

This problems has been reported to slick Slick Issue #1492 - Slick runs out of connections during extensive streaming usage, which is related to issue Slick Issue #1274 - Slick 3.0 transactionally deadlocks that should be fixed in Slick 3.2.0, when it eventually will be released. The transactional block has been removed from the akka-persistence-jdbc plugin, since it was used for writing to the deleted_to table, which does not exists anymore.

To be honest, Slick has more problems so I await the release of v3.2.0 and see if it is a better library. We will evaluate slick after the next release.

@dnvriend dnvriend self-assigned this Sep 3, 2016
@dnvriend dnvriend closed this as completed Nov 3, 2016
@octonato octonato added this to the invalid/not release bound milestone Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants