B4J Question TimeoutException

incendio

Well-Known Member
Licensed User
Longtime User
Hi guys,

I have running jRDC2 for months without any errors, now suddenly, got TimeOut Exception Error on server.

This error occurred randomly but always occurred after server starts. Have to restart jar file again to make it work again.

Any idea what could cause this errors?

Note :
Database server is Firebird 3.03, B4j 7.32, OS, Ubuntu Server 16.0.

Sorry for previous post that I post in Tutorial forum, I really didn't realize it.
 

incendio

Well-Known Member
Licensed User
Longtime User
The client connection was failed.

Here is the error message I got from server:
(TimeoutException) com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@2959535c -- timeout at awaitAvailable()

After that error, I have to forced shutdown the jar file on server and restarted again to made connection normal again.

The client were Android application.

Is there a way to catch this error on server side so that when error reappeared again the app on server can automatically restarted ?
 
Upvote 0

OliverA

Expert
Licensed User
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
Has your traffic increased? Have the queries changed? One of the issues could be that your pool size is to small. The default pool size for c3p0 is 15.

Links:
3cp0 docs:
https://www.mchange.com/projects/c3p0/#maxPoolSize
Info on code for changing pool size:
https://www.b4x.com/android/forum/threads/database-connection-pool-question.39816/#post-237044

No change in queries, but there were traffic increased when error occurred.

I always close connection as soon as possible, and there was data synchronization between Android device and server. This process only happen when there were master data changes in server side and it will uploaded thousand of records from server to Android device.
 
Upvote 0

OliverA

Expert
Licensed User
jRDC2 is pretty good about closing connections as fast as possible, but the sync may saturate the pool. I would definitely try increasing the pool size. Note: my assumption here is that the Firebird dB uses an unmodified jRDC2 that allows for pool usage (unlike SQLite).
 
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
jRDC2 is pretty good about closing connections as fast as possible, but the sync may saturate the pool. I would definitely try increasing the pool size. Note: my assumption here is that the Firebird dB uses an unmodified jRDC2 that allows for pool usage (unlike SQLite).
Thanks for the tips. I have increased pool size to 100 and see if this will solve the problem.
 
Upvote 0
Top