DatabaseManager and connection pooling
Posted: 21 Apr 2009, 16:46
Hi,
We have a zone-level extension and while it has been working fine, we have been seeing some database-related issues in the last few days.
Earlier today, our extension could not execute any queries to the database, with the following error in the SFS logs:
DbManager could not retrive a connection. org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
Restarting smartfox fixed that, but I'm wondering why it occurred and what we can do to prevent it from happening again.
Currently we are executing queries directly through the DatabaseManager.executeQuery(sql) call, and are not using getConnection() at all. Since our extension is not (at this point) multithreaded, is there an advantage to using getConnection()? Does executeQuery() use the connection pool behind the scenes?
Not sure if this is related or not, but we have been getting quite a few socket timeouts on our database connection lately. I had initially thought that this was just a networking problem, but now I'm not sure if it's related to the above problem. The end of a traceback is pasted below.
Thanks.
We have a zone-level extension and while it has been working fine, we have been seeing some database-related issues in the last few days.
Earlier today, our extension could not execute any queries to the database, with the following error in the SFS logs:
DbManager could not retrive a connection. org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
Restarting smartfox fixed that, but I'm wondering why it occurred and what we can do to prevent it from happening again.
Currently we are executing queries directly through the DatabaseManager.executeQuery(sql) call, and are not using getConnection() at all. Since our extension is not (at this point) multithreaded, is there an advantage to using getConnection()? Does executeQuery() use the connection pool behind the scenes?
Not sure if this is related or not, but we have been getting quite a few socket timeouts on our database connection lately. I had initially thought that this was just a networking problem, but now I'm not sure if it's related to the above problem. The end of a traceback is pasted below.
Thanks.
Code: Select all
INFO | jvm 1 | 2009/04/21 06:17:06 | at it.gotoandplay.smartfoxserver.extensions.PythonExtension.handleRequest(PythonExtension.java:203)
INFO | jvm 1 | 2009/04/21 06:17:06 | at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.processEvent(ExtensionHandler.java:539)
INFO | jvm 1 | 2009/04/21 06:17:06 | at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.run(ExtensionHandler.java:344)
INFO | jvm 1 | 2009/04/21 06:17:06 | at java.lang.Thread.run(Unknown Source)
INFO | jvm 1 | 2009/04/21 06:17:06 | Caused by: java.net.SocketTimeoutException: Read timed out
INFO | jvm 1 | 2009/04/21 06:17:06 | at java.net.SocketInputStream.socketRead0(Native Method)
INFO | jvm 1 | 2009/04/21 06:17:06 | at java.net.SocketInputStream.read(Unknown Source)
INFO | jvm 1 | 2009/04/21 06:17:06 | at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135)
INFO | jvm 1 | 2009/04/21 06:17:06 | at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104)
INFO | jvm 1 | 2009/04/21 06:17:06 | at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73)
INFO | jvm 1 | 2009/04/21 06:17:06 | at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259)
INFO | jvm 1 | 2009/04/21 06:17:06 | at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1182)
INFO | jvm 1 | 2009/04/21 06:17:06 | at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)