Greetings;

If you can, send some code that uses the connection.  From that I
think we can rule out an improperly handled connection.  There are a
few patterns to look for in connection handling that can cause this
type of issue.

I had a case once where I opened two connections and only closed one
of them .. it took a day or two for my connection pool to start timing
out.

Something like this seems like it will be in the Java code.

Have a super day,

John


On 2/18/19, fai...@bestercapitalmedia.com <fai...@bestercapitalmedia.com> wrote:
> Hi John,
>
> I am working in spring boot (maven) project.
> I am not doing exclusive null-out of the connection feeling that spring boot
> will manage it, do I still need to manage it myself?
> If you want I can list the dependencies here.
>
> I have just added the following dependency but didn’t try yet on production
> server.
>               <dependency>
>                       <groupId>com.zaxxer</groupId>
>                       <artifactId>HikariCP</artifactId>
>                       <version>2.7.8</version>
>                       <scope>compile</scope>
>               </dependency>
>
> Regards,
> Faisal Zaidi
>
> -----Original Message-----
> From: John Dale [mailto:jcdw...@gmail.com]
> Sent: Monday, February 18, 2019 5:45 PM
> To: Tomcat Users List
> Subject: Re: Tomcat connection error
>
> I agree - release your connection, commit transaction (if you have
> auto-commit set to false), and null-out your connection references.
>
> The analogy in c++ is you need deallocate memory.
>
> Java has GC in Java at a base level, but we also have some resource
> reclamation at higher levels of abstraction over which GC has no purview.
> Pooling (threads, connections) is an example.  The connection pool needs to
> reclaim its connections for reallocation to other threads.  If it can't, the
> application will hang waiting for connections.
>
> Do you have a static references to a database connection?
>
> The golden rule with database connections is acquire them late and release
> them early.  I like to create try/catch/finally blocks.  In the finally
> block, which executes even if there is an exception, I commit the
> transaction and set connection reference to null.
>
> As a matter of course, I would null out and close references to
> PreparedStatements and ResultSets as well (especially ResultSets).
>
> I'm sure you'll figure it out.
>
> Sincerely,
>
> John
>
>
> On 2/18/19, Mark Thomas <ma...@apache.org> wrote:
>> On 18/02/2019 10:24, fai...@bestercapitalmedia.com wrote:
>>> Hi Ted,
>>>
>>> Yes, you are right.
>>> I just need to restart the tomcat to get back it on.
>>> There is no need to restart the mySql in my case.
>>>
>>> Any clue please.
>>
>> Sounds like a connection leak in the web application. I expect the
>> connection pool includes tools to help you track that sort of problem
>> down.
>>
>> Mark
>>
>>
>>>
>>> Faisal Zaidi
>>>
>>> -----Original Message-----
>>> From: Ted Spradley [mailto:ted.k.sprad...@gmail.com]
>>> Sent: Monday, February 18, 2019 1:52 PM
>>> To: Tomcat Users List
>>> Subject: Re: Tomcat connection error
>>>
>>> Hi Faisal,
>>>
>>> Your application(s) run as expected for a while, then you get the SQL
>>> Connection error? Then the only way to “fix it” is to restart Tomcat?
>>> At the same time are you also restarting MySQL?
>>>
>>> Thanks,
>>> Ted
>>>
>>>> On Feb 18, 2019, at 02:17, Luis Rodríguez Fernández
>>>> <uo67...@gmail.com>
>>>> wrote:
>>>>
>>>> Hello Faisal,
>>>>
>>>> It looks like your problem is more related with your hikari
>>>> connection pool than with tomcat itself. I would recommend you to
>>>> double check your hikari configuration properties. Pay specially
>>>> attention on how you are configuring your connection pool (minimum
>>>> and maximum size, timeout,
>>>> etc...) It looks like there is "something" in your application that
>>>> prevents to get connections from your pool.
>>>>
>>>> Hope it helps,
>>>>
>>>> Luis
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> El lun., 18 feb. 2019 a las 6:33, <fai...@bestercapitalmedia.com>
>>>>> escribió:
>>>>>
>>>>> Dear all,
>>>>>
>>>>>
>>>>>
>>>>> I am working on a project and I am facing following issue on almost
>>>>> every second day. I need to restart tomcat to get it running again.
>>>>>
>>>>> Can someone guide me on it. Ask if you need some other insight to
>>>>> look into it.
>>>>>
>>>>>
>>>>>
>>>>> 2019-02-18 04:49:35.572  WARN 20698 --- [io-4200-exec-15]
>>>>> o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState:
>>>>> null
>>>>>
>>>>> 2019-02-18 04:49:35.572 ERROR 20698 --- [io-4200-exec-15]
>>>>> o.h.engine.jdbc.spi.SqlExceptionHelper   : HikariPool-1 - Connection
>>>>> is
>>>>> not
>>>>> available, request timed out after 30000ms.
>>>>>
>>>>> 2019-02-18 04:49:35.573  WARN 20698 --- [io-4200-exec-15]
>>>>> o.s.s.o.provider.endpoint.TokenEndpoint  : Handling error:
>>>>> InternalAuthenticationServiceException, Unable to acquire JDBC
>>>>> Connection; nested exception is
>>>>> org.hibernate.exception.JDBCConnectionException: Unable to acquire
>>>>> JDBC Connection
>>>>>
>>>>>
>>>>>
>>>>> Server is Ubuntu (aws)
>>>>>
>>>>> Database is mySql
>>>>>
>>>>> java version "1.8.0_181"
>>>>>
>>>>> Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
>>>>>
>>>>> Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
>>>>>
>>>>>
>>>>>
>>>>> Best Regards | Bien Cordialement | تحياتي
>>>>>
>>>>> Faisal Zaidi
>>>>> Application Architect
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>>
>>>> "Ever tried. Ever failed. No matter. Try Again. Fail again. Fail
>>>> better."
>>>>
>>>> - Samuel Beckett
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to