miaoyf / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

java melody reporting large Nb of used jdbc connections with Spring Routing Data source #399

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Configure a MYSQL Routing Data source by extending AbstractRoutingDataSource 
from Spring and using approach explain here 
http://spring.io/blog/2007/01/23/dynamic-datasource-routing/
2. Now when we send some request which involves database operation using that 
routing data source
3. Java melody reports invalid number of used jdbc connections. It reports one 
active connection per request and number of active connections keeps increasing 
as the request comes. Even it exceeds the pool size. On the other hands MYSQL 
DBMS is reporting correct number of connections

Number of active jdbc connections are not correct, java melody shows that 
connection count is increasing as the request count increases 

JavaMelody version: 1.32.1
Server version: Apache Tomcat/6.0.35
OS Name:        Linux
OS Version:     3.10.34-39.137.amzn1.x86_64
Architecture:   amd64
JVM Version:    1.6.0_30-b30 (IcedTea6 1.13.1)
JVM Vendor:     Sun Microsystems Inc.

Original issue reported on code.google.com by atifo...@gmail.com on 31 Mar 2014 at 10:59

Attachments:

GoogleCodeExporter commented 8 years ago
Can you give a zip file of the source of a project to reproduce the issue?
(It would be great to use Maven for dependencies of the project.)

Original comment by evernat@free.fr on 31 Mar 2014 at 12:48

GoogleCodeExporter commented 8 years ago
Without a working project to reproduce the issue, I have thought of what could 
be the problem.

And I think that routing datasource and target datasources were both 
incrementing used connections count, but decrementing was intelligent enough to 
see that this was already done for a connection.
I have changed the code in trunk (revision 3768) to increment only when needed.
It's ready for the next release (1.51) and will available within 24h in nightly 
builds.

Original comment by evernat@free.fr on 13 Apr 2014 at 2:09