supertokens-core icon indicating copy to clipboard operation
supertokens-core copied to clipboard

DB connection pool size issue

Open rishabhpoddar opened this issue 2 years ago • 2 comments

Even if we set server thread pool size and db connection pool size to 1, the core occasionally complains about not being able to get a connection even after 5 seconds:

io.supertokens.webserver.WebserverAPI.service(WebserverAPI.java:165) | javax.servlet.ServletException: io.supertokens.pluginInterface.exceptions.StorageQueryException: java.sql.SQLTransientConnectionException: SuperTokens - Connection is not available, request timed out after 5000ms.",
   "\u0001\u0000\u0000\u0000\u0000\u0000\u0000�07 Dec 2022 05:05:32:513 +0000 | ERROR | pid: 1f5cf52e-fa81-4cee-8948-da190eec0803 | [http-nio-0.0.0.0-8082-exec-1] thread | io.supertokens.webserver.WebserverAPI.service(WebserverAPI.java:165) | API threw an exception: POST /recipe/session/refresh"

This should really never happen given that both the connection and web server pool size is the same and each API uses one connection and releases it (unless there is a bug). We do have cronjobs that also use one connection each, but those connections should still be available after 5 seconds.

rishabhpoddar avatar Dec 07 '22 06:12 rishabhpoddar

I mostly know the solution and would love to solve it for you. Assign me the issue.

govindraj111 avatar Dec 08 '22 18:12 govindraj111

hey @govindraj111 could you please describe the solution before I assign it to you?

rishabhpoddar avatar Dec 08 '22 19:12 rishabhpoddar