[play 2.2.1 java] BoneCP detected an unclosed connection

1,729 views
Skip to first unread message

Gaurav Mathur

unread,
Nov 29, 2013, 12:31:48 PM11/29/13
to play-fr...@googlegroups.com
Im running the latest version of play (2.2.1) where Im still seeing BoneCP unclosed connection errors. Based on the forums it sounds like there was an issue with older versions of boneCP that caused this problem that should be fixed with the version that ships out with play 2.2.1

I am not grabbing the database connection directly in any part of my application and going through ebeans for all database operations. Based on that, I assume the leak is being caused by either a) my misuse of ebeans (somehow) or b) a bug within ebeans itself.

Any pointers on what might be going on? At the minimum can someone point me to how I can enable connectionWatch to try and debug where this leak could be happening?

Thanks,
Gaurav

Error:
com.jolbox.bonecp.ConnectionPartition - BoneCP detected an unclosed connection and will now attempt to close it for you. You should be closing this connection in your application - enable connectionWatch for additional debugging assistance or set disableConnectionTracking to true to disable this feature entirely.

Niklas Nylund

unread,
Dec 2, 2013, 6:25:06 AM12/2/13
to play-fr...@googlegroups.com
You have probably seen the lengthy thread about his issue. Tweaking the db config seems to help somewhat but not completely in our experience. 


Niklas

Gaurav Mathur

unread,
Dec 5, 2013, 2:31:55 AM12/5/13
to play-fr...@googlegroups.com
Thanks Niklas - I was hoping there was a more permanent cure to the problem but I guess not.

Any pointers on ORM frameworks/BoneCP replacements that work well in production?


- G


--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/eshzvWuNQcc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

virtualeyes

unread,
Dec 5, 2013, 3:44:26 AM12/5/13
to play-fr...@googlegroups.com
com.jolbox.bonecp.ConnectionPartition

Just a stab in the dark, but how many CPU cores are available for your Play application?

# of cores = partitionCount; setting a higher partitionCount than available cores could cause issues.

Otherwise, if nothing works and Ebean + BoneCP is borken (sp?), BoneCP author himself just plugged this very impressive library (if the benchmark claims are indeed true) which requires Java 7

BoneCP User

unread,
Dec 5, 2013, 4:57:31 AM12/5/13
to play-fr...@googlegroups.com
Hi,

Am also facing similar issue with Hibernate+Bone CP 0.8.0.

Would like to understand how partition count could cause this.

Also if we disable connection tracking will there be connection leak?

Keith Rockhold

unread,
Dec 5, 2013, 2:56:26 PM12/5/13
to play-fr...@googlegroups.com
To solve this issue in our environment, we used the Global.java's onStart method (the same can be set in Global.scala) to set options in BoneCP which aren't normally exposed in Play:

 BoneCPDataSource ds = (BoneCPDataSource)play.db.DB.getDataSource();
 ds.setStatisticsEnabled(true);
 ds.setReleaseHelperThreads(2);

The important value is the Release Helper threads, which is, sadly deprecated. Last year there were problems with this setting in some environments, so it was removed from Play as a conf option and is to be removed from BoneCP (in fact was supposed to be in 0.8 but luckily it is still there, as it is the only thing we have been able to do to stop BoneCP from eventually running out of connections. Caveat Emptor.
Reply all
Reply to author
Forward
0 new messages