jenkinsci / audit2db-plugin

Jenkins plugin to record build audit information to database.
https://plugins.jenkins.io/audit2db/
5 stars 24 forks source link

Remove sleep connections #6

Open ricardogarfe opened 10 years ago

ricardogarfe commented 10 years ago

Hi! I want to configure hibernate connections to remove active or sleep connections.

Hibernate configuration:

        <property name="c3p0.max_size">10</property>
        <property name="c3p0.min_size">2</property>
        <property name="c3p0.timeout">1800</property>
        <property name="c3p0.max_statements">50</property>
        <property name="connection.autocommit">true</property>

The problem is that max connections overrides defined value in hibernate (10) I have 12. Every new Job registered with Audit2db retrieves 2 new connections.

$ echo "SHOW PROCESSLIST" | mysql --user=jenkins --password=jenkins
Id  User    Host    db  Command Time    State   Info
109 jenkins localhost:48405 jenkinsdb   Sleep   299     NULL
110 jenkins localhost:48407 jenkinsdb   Sleep   1014        NULL
111 jenkins localhost:48408 jenkinsdb   Sleep   1014        NULL
114 jenkins localhost:48409 jenkinsdb   Sleep   241     NULL
117 jenkins localhost:48422 jenkinsdb   Sleep   235     NULL
118 jenkins localhost:48421 jenkinsdb   Sleep   2247        NULL
131 jenkins localhost:48438 jenkinsdb   Sleep   1921        NULL
132 jenkins localhost:48437 jenkinsdb   Sleep   1921        NULL
133 jenkins localhost:48440 jenkinsdb   Sleep   1914        NULL
134 jenkins localhost:48441 jenkinsdb   Sleep   1917        NULL
152 jenkins localhost:48459 jenkinsdb   Sleep   231     NULL
153 jenkins localhost:48460 jenkinsdb   Sleep   231     NULL
157 jenkins localhost:48461 jenkinsdb   Sleep   78      NULL
158 jenkins localhost:48462 jenkinsdb   Sleep   53      NULL
159 jenkins localhost   NULL    Query   0   NULL    SHOW PROCESSLIST

The value representig timeout 1800 (secs) doesn't remove sleep connections.

I think there is another value like idle_test_period that hast to be set (if I've understood the meaning) to remove idle connections.

Or the problem is, that _maxstatements is the value that I'm looking for ?

Am I right ? Thanks!

lulonglong commented 9 years ago

I have the same problem

inmjava commented 6 years ago

Same problem here