Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:03:58+00:00 2026-06-15T19:03:58+00:00

I do a project merging Hibernate and Spring in a Java web application, using

  • 0

I do a project merging Hibernate and Spring in a Java web application, using Tomcat under Linux environment. Due to the Mysql 8 hours timeout problem, we want to use C3P0 to manage a connection pool with our Mysql database.
But when we use it, we have numerous threads that are created. I figured it out beacause I did on each request a print of all of them with a memory status that show me the increasing memory and that kind of threads:

  • name: C3P0PooledConnectionPoolManager[identityToken->1hged7o8r13kpj7n1h3ycia|39c446]-HelperThread-#0 daemon: true group! main groupParent: system alive: true interrupted: false
  • name: C3P0PooledConnectionPoolManager[identityToken->1hged7o8r13kpj7n1h3ycia|17ec0e8]-AdminTaskTimer daemon: true group! main groupParent: system alive: true interrupted: false

It can produce more than 500 threads like these ones, after enough time.

Here is my Hibernate.cfg.xml:

    <property name="connection.provider_class">
            org.hibernate.connection.C3P0ConnectionProvider</property>
    <property name="hibernate.c3p0.acquire_increment">1</property> 
    <property name="hibernate.c3p0.idle_test_period">5</property>
    <property name="hibernate.c3p0.max_size">100</property> 
    <property name="hibernate.c3p0.max_statements">100</property> 
    <property name="hibernate.c3p0.min_size">10</property> 
    <property name="hibernate.c3p0.timeout">5</property>

    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/myBase</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password"></property>
    <property name="hibernate.hbm2ddl.auto">update</property>
    <property name="hibernate.default_schema">myProject</property>
    <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
    <property name="show_sql">false</property>

    <property name="cache.provider_class">
      org.hibernate.cache.NoCacheProvider
    </property>         

I also tried to add a C3P0 propeties file, but except reducing the helper thread number, it don’t delete the unsused thread:

    c3p0.maxStatements=5    

c3p0.maxIdleTime=10

c3p0.numHelperThreads=1

c3p0.testConnectionOnCheckout=true
c3p0.preferredTestQuery=SELECT 1

c3p0.initialPoolSize=1
c3p0.minPoolSize=1
c3p0.maxPoolSize=10

c3p0.acquireIncrement=1
c3p0.idleConnectionTestPeriod=1

Does anyone have an idea of why this happen and how to solve this problem?

Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:03:59+00:00Added an answer on June 15, 2026 at 7:03 pm

    Ok I found a combination of properties to solve my problem, keeping in mind that I don’t need a lot of connection at a time:

    • c3p0.maxStatements=5
    • c3p0.maxIdleTime=10
    • c3p0.numHelperThreads=3
    • c3p0.testConnectionOnCheckout=true
    • c3p0.preferredTestQuery=SELECT 1
    • c3p0.initialPoolSize=1
    • c3p0.minPoolSize=1
    • c3p0.maxPoolSize=1
      c3p0.acquireIncrement=1
    • c3p0.idleConnectionTestPeriod=1
    • c3p0.maxAdministrativeTaskTime=1

    Thanks to everyone

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just inherited a large web project using SVN for VCS. There are no
I'm merging a static library (assimp) into an existing project (Spring RTS) where both
I'm writing a GWT-Hibernate internal web application for our development group. Previously, I had
I have a Spring / Hibernate project and I am trying to store a
In my project site I am merging a base image (a map) with markers
Project: http://design.vitalbmx.com/fave/news.html When I click Add to favorites button (under main pic), in Chrome
I have working code using the spring-ws library to respond to soap requests. I
I'm having trouble merging the two concepts of using a SplitViewController in my main
I have forked an SVN project using Git because I needed to add features
I had a problem with committing changes after merging two branches of my project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.