nicolas-raoul / Commons-DBCP-monitoring

Monitor what threads are using connections from the DBCP pool, and generate a nice graph to understand what is happening.
Apache License 2.0
29 stars 8 forks source link

commons-dbcp-1.4-monitored.jar doesn't output monitored stats to log file? #1

Closed cyu021 closed 9 years ago

cyu021 commented 9 years ago

Hi,

I have already replaced the common "commons-dbcp-1.4.jar" with "commons-dbcp-1.4-monitored.jar", and I am unable to tell whether it works since I cannot find any line starts with "DBCPMONITOR;". I have two deployments. One is deployed as standalone JVM, and the other is deployed to Websphere Application Server (WAS) JVM. Both running JDK 1.7 and built with Spring framework. How do I enable the monitoring feature?

Thanks.

I checked my log files with the following commands:

daemon log

$ tail -50000 daemon.log | grep DBCPMONITOR;

screen shot 2015-10-20 at 2 29 39 pm

WAS log

$ tail -50000 SystemOut.log | grep DBCPMONITOR;

screen shot 2015-10-20 at 2 30 11 pm
nicolas-raoul commented 9 years ago

Could you please:

cyu021 commented 9 years ago

output for daemon's lib, AbandonedObjectPool only exists in commons-dbcp-1.4-monitored.jar

[ tmp]$ cat commonLib.log
activation-1.1.jar
activemq-core-5.7.0.jar
activemq-pool-5.7.0.jar
activemq-protobuf-1.1.jar
aether-api-1.13.1.jar
aether-connector-file-1.13.1.jar
aether-connector-wagon-1.13.1.jar
aether-impl-1.13.1.jar
aether-spi-1.13.1.jar
aether-util-1.13.1.jar
annotations-2.0.1.jar
ant-1.8.2.jar
ant-launcher-1.8.2.jar
antlr-2.7.7.jar
antlr-runtime-3.5.jar
aopalliance-1.0.jar
asm-3.3.1.jar
asm-all-3.0.jar
aspectjrt-1.7.0.jar
aspectjweaver-1.7.0.jar
axis-1.4.jar
axis-jaxrpc-1.4.jar
bcel-5.1.jar
cal10n-api-0.7.7.jar
castor-1.2.jar
cdi-api-1.0-SP4.jar
cglib-2.2.2.jar
commons-beanutils-1.8.3.jar
commons-betwixt-0.8.jar
commons-chain-1.1.jar
commons-codec-1.3.jar
commons-collections-3.2.1.jar
commons-dbcp-1.4-monitored.jar
-rw-r--r--  2.0 unx     4430 b- defN 12-Aug-06 11:36 org/apache/commons/dbcp/AbandonedObjectPool.class
commons-digester-1.8.jar
commonservices-1.0.jar
commons-httpclient-3.1.jar
commons-io-2.4.jar
commons-lang-2.5.jar
commons-logging-1.1.1.jar
commons-logging-api-1.0.4.jar
commons-net-3.1.jar
commons-pool-1.6.jar
commons-validator-1.3.1.jar
datasource-proxy-1.0.jar
db2jcc-10.1.jar
db2jcc_license_cu-10.1.jar
ddlutils-1.0.jar
dev-core-1.21.jar
dev-core-1.24.jar
dev-core-1.25.jar
dev-support-1.21.jar
dev-support-1.24.jar
dev-support-1.25.jar
dom4j-1.6.1.jar
drools-compiler-6.1.0.Final.jar
drools-core-6.1.0.Final.jar
drools-decisiontables-6.1.0.Final.jar
drools-persistence-jpa-6.1.0.Final.jar
drools-templates-6.1.0.Final.jar
ecj-4.3.1.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar
geronimo-jta_1.0.1B_spec-1.0.1.jar
groovy-all-2.3.7.jar
guava-16.0.jar
hawtbuf-1.9.jar
hawtdispatch-1.11.jar
hawtdispatch-transport-1.11.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.1.7.Final.jar
hibernate-entitymanager-4.1.7.Final.jar
hibernate-infinispan-4.1.7.Final.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
hibernate-validator-4.3.0.Final.jar
httpclient-4.1.2.jar
httpcore-4.2.1.jar
icu4j-54.1.1.jar
imgscalr-lib-4.2.jar
infinispan-core-5.1.6.FINAL.jar
jackson-annotations-2.3.0.jar
jackson-core-2.3.0.jar
jackson-core-asl-1.9.9.jar
jackson-core-lgpl-1.9.13.jar
jackson-databind-2.3.0.jar
jackson-datatype-hibernate4-2.3.0.jar
jackson-mapper-lgpl-1.9.13.jar
jasypt-1.9.0.jar
javassist-3.15.0-GA.jar
javax.el-2.2.4.jar
javax.el-api-2.2.4.jar
javax.inject-1.jar
javax.management.j2ee-api-1.1.1.jar
jaxen-1.1.3.jar
jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar
jboss-logging-3.1.0.GA.jar
jboss-marshalling-1.3.11.GA.jar
jboss-marshalling-river-1.3.11.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
jbpm-audit-6.1.0.Final.jar
jbpm-bpmn2-6.1.0.Final.jar
jbpm-flow-6.1.0.Final.jar
jbpm-flow-builder-6.1.0.Final.jar
jbpm-human-task-audit-6.1.0.Final.jar
jbpm-human-task-core-6.1.0.Final.jar
jbpm-human-task-jpa-6.1.0.Final.jar
jbpm-human-task-workitems-6.1.0.Final.jar
jbpm-persistence-jpa-6.1.0.Final.jar
jbpm-runtime-manager-6.1.0.Final.jar
jbpm-shared-services-6.1.0.Final.jar
jcl-over-slf4j-1.7.6.jar
jdom-1.0.jar
jdom-1.1.2.jar
jettison-1.1.jar
jgroups-3.0.11.Final.jar
jms-1.1.jar
joda-time-2.3.jar
jpa-api-2.0-cr-1.jar
jrules-engine-8.5.jar
jsoup-1.7.2.jar
jsr250-api-1.0.jar
jta-1.1.jar
jxl-2.6.10.jar
kahadb-5.7.0.jar
kie-api-6.1.0.Final.jar
kie-ci-6.1.0.Final.jar
kie-internal-6.1.0.Final.jar
log4j-1.2.17.jar
log4jdbc4-1.2-fet.jar
log4j-over-slf4j-1.7.6.jar
logback-classic-1.1.2.jar
logback-core-1.1.2.jar
mail-1.4.jar
maven-aether-provider-3.0.5.jar
maven-artifact-3.0.5.jar
maven-compat-3.0.5.jar
maven-core-3.0.5.jar
maven-model-3.0.5.jar
maven-model-builder-3.0.5.jar
maven-plugin-api-3.0.5.jar
maven-repository-metadata-3.0.5.jar
maven-settings-3.0.5.jar
maven-settings-builder-3.0.5.jar
mms-vasp-1.0.jar
mq-6.0.2.1.jar
mqjms-1.0.jar
mqtt-client-1.3.jar
mvel2-2.2.1.Final.jar
openxml4j-1.0-beta.jar
oro-2.0.8.jar
pcf-1.0.jar
plexus-cipher-1.4.jar
plexus-classworlds-2.4.jar
plexus-component-annotations-1.5.5.jar
plexus-interpolation-1.14.jar
plexus-sec-dispatcher-1.3.jar
plexus-utils-2.0.6.jar
poi-3.10-FINAL.jar
poi-ooxml-3.10-FINAL.jar
poi-ooxml-schemas-3.10-FINAL.jar
protobuf-java-2.5.0.jar
reflections-0.9.9.jar
reflections-FET-0.9.9-RC1.jar
regexp-1.2.jar
resource-1.0.jar
rhq-pluginAnnotations-3.0.4.jar
sam-8.5.jar
servlet-api-2.5.jar
sisu-guava-0.9.9.jar
sisu-guice-3.1.0-no_aop.jar
sisu-inject-bean-2.3.0.jar
sisu-inject-plexus-2.3.0.jar
sitemesh-2.4.2.jar
slf4j-api-1.7.6.jar
solder-api-3.2.1.Final.jar
solder-logging-3.2.1.Final.jar
spring-aop-3.1.2.RELEASE.jar
spring-asm-3.1.2.RELEASE.jar
spring-batch-core-2.1.7.RELEASE.jar
spring-batch-infrastructure-2.1.7.RELEASE.jar
spring-beans-3.1.2.RELEASE.jar
spring-context-3.1.2.RELEASE.jar
spring-context-support-3.1.2.RELEASE.jar
spring-core-3.1.2.RELEASE.jar
spring-expression-3.1.2.RELEASE.jar
spring-integration-core-3.0.6.RELEASE.jar
spring-integration-http-2.1.4.RELEASE.jar
spring-integration-jms-3.0.6.RELEASE.jar
spring-integration-jpa-3.0.6.RELEASE.jar
spring-jdbc-3.1.2.RELEASE.jar
spring-jms-3.1.2.RELEASE.jar
spring-orm-3.1.2.RELEASE.jar
spring-oxm-3.1.2.RELEASE.jar
spring-retry-1.0.3.RELEASE.jar
spring-security-core-3.1.2.RELEASE.jar
spring-security-web-3.1.2.RELEASE.jar
spring-tx-3.1.2.RELEASE.jar
spring-web-3.1.2.RELEASE.jar
spring-webmvc-3.1.2.RELEASE.jar
sqlserver-jdbc-1.0.jar
sslext-1.2-0.jar
stax2-api-3.1.1.jar
stax-api-1.0.1.jar
struts-core-1.3.8.jar
struts-taglib-1.3.8.jar
struts-tiles-1.3.8.jar
tibcrypt-2.14.100.006.jar
tibemsd-sec-7.0.0.jar
tibjms-7.0.0.jar
tibjmsadmin-7.0.3.jar
tibjmsapps-7.0.0.jar
tibjmsufo-7.0.0.jar
tibrvjms-7.0.0.jar
validation-api-1.1.0.Final.jar
velocity-1.7.jar
velocity-tools-2.0.jar
wagon-http-2.0.jar
wagon-http-shared4-2.0.jar
wagon-provider-api-2.4.jar
weld-api-1.1.Final.jar
weld-core-1.1.21.Final.jar
weld-spi-1.1.Final.jar
woodstox-core-asl-4.1.1.jar
xalan-2.6.0.jar
xercesImpl-2.9.1.jar
xml-apis-1.3.04.jar
xmlbeans-2.3.0.jar
xmlParserAPIs-2.6.2.jar
xmlpull-1.1.3.1.jar
xom-1.0.jar
xpp3_min-1.1.4c.jar
xstream-1.4.1.jar

output for WAS instance's lib, AbandonedObjectPool only exists in commons-dbcp-1.4-monitored.jar

[ tmp]$ cat was.log
activation-1.1.jar
activemq-core-5.7.0.jar
activemq-pool-5.7.0.jar
activemq-protobuf-1.1.jar
aether-api-1.13.1.jar
aether-connector-file-1.13.1.jar
aether-connector-wagon-1.13.1.jar
aether-impl-1.13.1.jar
aether-spi-1.13.1.jar
aether-util-1.13.1.jar
ant-1.8.2.jar
ant-launcher-1.8.2.jar
antlr-2.7.7.jar
antlr-runtime-3.5.jar
aopalliance-1.0.jar
asm-3.3.1.jar
asm-all-3.0.jar
aspectjrt-1.7.0.jar
aspectjweaver-1.7.0.jar
axis-1.4.jar
axis-jaxrpc-1.4.jar
bcel-5.1.jar
cal10n-api-0.7.7.jar
castor-1.2.jar
cdi-api-1.0-SP4.jar
cglib-2.2.2.jar
commons-beanutils-1.8.3.jar
commons-betwixt-0.8.jar
commons-chain-1.1.jar
commons-codec-1.3.jar
commons-collections-3.2.1.jar
commons-dbcp-1.4-monitored.jar
-rw-r--r--  2.0 unx     4430 b- defN 12-Aug-06 11:36 org/apache/commons/dbcp/AbandonedObjectPool.class
commons-digester-1.8.jar
commonservices-1.0.jar
commons-httpclient-3.1.jar
commons-io-2.4.jar
commons-lang-2.6.jar
commons-logging-1.1.jar
commons-logging-api-1.0.4.jar
commons-net-3.1.jar
commons-pool-1.6.jar
commons-validator-1.3.1.jar
datasource-proxy-1.0.jar
db2jcc-10.1.jar
db2jcc_license_cu-10.1.jar
ddlutils-1.0.jar
dev-core-1.25.jar
dev-support-1.25.jar
dom4j-1.6.1.jar
drools-compiler-6.1.0.Final.jar
drools-core-6.1.0.Final.jar
drools-decisiontables-6.1.0.Final.jar
drools-persistence-jpa-6.1.0.Final.jar
drools-templates-6.1.0.Final.jar
dsp-core-1.0.jar
ecj-4.3.1.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar
geronimo-jta_1.0.1B_spec-1.0.1.jar
groovy-all-2.3.7.jar
guava-16.0.jar
hawtbuf-1.9.jar
hawtdispatch-1.11.jar
hawtdispatch-transport-1.11.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.1.7.Final.jar
hibernate-entitymanager-4.1.7.Final.jar
hibernate-infinispan-4.1.7.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-validator-4.3.0.Final.jar
httpclient-4.1.2.jar
httpcore-4.2.1.jar
icu4j-54.1.1.jar
imgscalr-lib-4.2.jar
infinispan-core-5.1.6.FINAL.jar
jackson-annotations-2.3.0.jar
jackson-core-2.3.0.jar
jackson-core-asl-1.9.9.jar
jackson-core-lgpl-1.9.13.jar
jackson-databind-2.3.0.jar
jackson-datatype-hibernate4-2.3.0.jar
jackson-mapper-lgpl-1.9.13.jar
jasypt-1.9.0.jar
javassist-3.15.0-GA.jar
javax.el-2.2.4.jar
javax.el-api-2.2.4.jar
javax.inject-1.jar
javax.management.j2ee-api-1.1.1.jar
jaxen-1.1.3.jar
jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar
jboss-logging-3.1.0.GA.jar
jboss-marshalling-1.3.11.GA.jar
jboss-marshalling-river-1.3.11.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
jbpm-audit-6.1.0.Final.jar
jbpm-bpmn2-6.1.0.Final.jar
jbpm-flow-6.1.0.Final.jar
jbpm-flow-builder-6.1.0.Final.jar
jbpm-human-task-audit-6.1.0.Final.jar
jbpm-human-task-core-6.1.0.Final.jar
jbpm-human-task-jpa-6.1.0.Final.jar
jbpm-human-task-workitems-6.1.0.Final.jar
jbpm-persistence-jpa-6.1.0.Final.jar
jbpm-runtime-manager-6.1.0.Final.jar
jbpm-shared-services-6.1.0.Final.jar
jcl-over-slf4j-1.7.6.jar
jdom-1.0.jar
jdom-1.1.2.jar
jettison-1.1.jar
jgroups-3.0.11.Final.jar
jms-1.1.jar
joda-time-2.3.jar
jpa-api-2.0-cr-1.jar
jrules-engine-8.5.jar
jsoup-1.7.2.jar
jsr250-api-1.0.jar
jta-1.1.jar
jxl-2.6.10.jar
kahadb-5.7.0.jar
kie-api-6.1.0.Final.jar
kie-ci-6.1.0.Final.jar
kie-internal-6.1.0.Final.jar
kie-spring-6.1.0.Final.jar
log4j-1.2.17.jar
log4jdbc4-1.2-fet.jar
log4j-over-slf4j-1.7.6.jar
logback-classic-1.1.2.jar
logback-core-1.1.2.jar
mail-1.4.jar
maven-aether-provider-3.0.5.jar
maven-artifact-3.0.5.jar
maven-compat-3.0.5.jar
maven-core-3.0.5.jar
maven-model-3.0.5.jar
maven-model-builder-3.0.5.jar
maven-plugin-api-3.0.5.jar
maven-repository-metadata-3.0.5.jar
maven-settings-3.0.5.jar
maven-settings-builder-3.0.5.jar
mms-vasp-1.0.jar
mq-6.0.2.1.jar
mqjms-1.0.jar
mqtt-client-1.3.jar
mvel2-2.2.1.Final.jar
openxml4j-1.0-beta.jar
oro-2.0.8.jar
pcf-1.0.jar
plexus-cipher-1.4.jar
plexus-classworlds-2.4.jar
plexus-component-annotations-1.5.5.jar
plexus-interpolation-1.14.jar
plexus-sec-dispatcher-1.3.jar
plexus-utils-2.0.6.jar
poi-3.10-FINAL.jar
poi-ooxml-3.10-FINAL.jar
poi-ooxml-schemas-3.10-FINAL.jar
protobuf-java-2.5.0.jar
reflections-FET-0.9.9-RC1.jar
regexp-1.2.jar
resource-1.0.jar
rhq-pluginAnnotations-3.0.4.jar
sam-8.5.jar
sdp-persistence-1.0.jar
sdp-service-1.0.jar
sisu-guice-3.1.0-no_aop.jar
sisu-inject-bean-2.3.0.jar
sisu-inject-plexus-2.3.0.jar
sitemesh-2.4.2.jar
slf4j-api-1.7.2.jar
solder-api-3.2.1.Final.jar
solder-logging-3.2.1.Final.jar
spring-aop-3.1.2.RELEASE.jar
spring-asm-3.1.2.RELEASE.jar
spring-batch-core-2.1.7.RELEASE.jar
spring-batch-infrastructure-2.1.7.RELEASE.jar
spring-beans-3.1.2.RELEASE.jar
spring-context-3.1.2.RELEASE.jar
spring-context-support-3.1.2.RELEASE.jar
spring-core-3.1.2.RELEASE.jar
spring-expression-3.1.2.RELEASE.jar
spring-integration-core-3.0.6.RELEASE.jar
spring-integration-http-2.1.4.RELEASE.jar
spring-integration-jms-3.0.6.RELEASE.jar
spring-integration-jpa-3.0.6.RELEASE.jar
spring-jdbc-3.1.2.RELEASE.jar
spring-jms-3.1.2.RELEASE.jar
spring-orm-3.1.2.RELEASE.jar
spring-oxm-3.1.2.RELEASE.jar
spring-retry-1.0.3.RELEASE.jar
spring-security-core-3.1.2.RELEASE.jar
spring-security-web-3.1.2.RELEASE.jar
spring-tx-3.1.2.RELEASE.jar
spring-web-3.1.2.RELEASE.jar
spring-webmvc-3.1.2.RELEASE.jar
sqlserver-jdbc-1.0.jar
sslext-1.2-0.jar
stax2-api-3.1.1.jar
stax-api-1.0.1.jar
struts-core-1.3.8.jar
struts-taglib-1.3.8.jar
struts-tiles-1.3.8.jar
tibcrypt-2.14.100.006.jar
tibemsd-sec-7.0.0.jar
tibjms-7.0.0.jar
tibjmsadmin-7.0.3.jar
tibjmsapps-7.0.0.jar
tibjmsufo-7.0.0.jar
tibrvjms-7.0.0.jar
validation-api-1.1.0.Final.jar
velocity-1.7.jar
velocity-tools-2.0.jar
wagon-http-2.0.jar
wagon-http-shared4-2.0.jar
wagon-provider-api-2.4.jar
weld-api-1.1.Final.jar
weld-core-1.1.21.Final.jar
weld-spi-1.1.Final.jar
woodstox-core-asl-4.1.1.jar
xalan-2.6.0.jar
xercesImpl-2.9.1.jar
xml-apis-1.3.04.jar
xmlbeans-2.3.0.jar
xmlParserAPIs-2.6.2.jar
xmlpull-1.1.3.1.jar
xom-1.0.jar
xpp3_min-1.1.4c.jar
xstream-1.4.7.jar
nicolas-raoul commented 9 years ago

Thanks for the lists! It looks like you replaced in all relevant places indeed.

Second, as seen at https://github.com/nicolas-raoul/Commons-DBCP-monitoring/blob/master/patch-for-commons-dbcp-1.4-src/src/java/org/apache/commons/dbcp/AbandonedObjectPool.java DBCPMONITOR; is printed to System.out. So, could you please start all your apps/app servers from command line and check that command line's output? I guess you have already run a grep -R to check whether it is hidden in a non-obvious log file somewhere?

cyu021 commented 9 years ago

I grep all sub-folders

find -name "*" -exec grep "AbandonedObjectPool" {} \; -print

screen shot 2015-10-20 at 3 39 05 pm screen shot 2015-10-20 at 3 43 26 pm
nicolas-raoul commented 9 years ago

It seems that there are commons-dbcp-1.4.jar files left, right? Would you mind replacing all of them with the monitored version? And purge work and temporary folders.

cyu021 commented 9 years ago

I will try to redeploy all webapp on WAS later, but there is only one monitored dbcp in daemon deployment?

cyu021 commented 9 years ago

I created a simple sandbox project and still don't see the "DBCPMONITOR;" on log The project can be downloaded from: https://www.dropbox.com/s/1ctjwc2v8su2hu3/sandbox_monitored_dbca.zip?dl=0 image

nicolas-raoul commented 9 years ago

Thanks a lot for the investigation! Would you getting the commons-dbcp source code, replacing this file and debugging to see what is going wrong? (I would love to do it myself but I am currently 100% busy with another of my open source projects)

cyu021 commented 9 years ago

Thanks for the heads up. I found out that I need to enable "removeAbandonedOnBorrow" and/or "removeAbandonedOnMaintenance" to get it to work. Please close this issue.

nicolas-raoul commented 9 years ago

Great to hear that your problem is solved! Is there any way this project could be modified so that it works in all cases including yours?

cyu021 commented 9 years ago

A reminding note on "removeAbandonedOnBorrow" and/or "removeAbandonedOnMaintenance" flags in readme file would do :-) Thanks for your great work!

nicolas-raoul commented 9 years ago

Would you mind writing the note? I actually don't know what these flags are... I will copy/paste your note to the README :-)

cyu021 commented 9 years ago

Be noted: for dbcp1.4 -- need to set "removeAbandoned" flag to "true" to enable monitoring feature