11 Replies Latest reply on Feb 10, 2005 5:35 PM by adrian.brock

    Finding unclosed Connections (CachedConfigurationManager con

      Hello,

      We suspect we have a leak where a Connnection and/or ResultSet is not being properly closed.

      I read the following Wiki, also mentioned in the : http://www.jboss.org/wiki/Wiki.jsp?page=WhatDoesTheMessageDoYourOwnHousekeepingMean

      Since we are using JBoss 4.0.0, I went to the jbossjca-service.xml, and the default values were already SpecCompliant=false, Debug=true.

      I wrote some code to create a Connection, run a query, and leave the statement, result set, and connection open. I was able to get the Connections to stay in use (jmx-console: name=DS,service=ManagedConnectionPool) but saw no message like:

      "Closing a connection for you" as mentioned in the Wiki in either STDOUT or server.log.

      My log4j.xml settings are also stock. Do I need to change the settings there to a more verbose log level?

      Thanks,
      Josh

        • 1. Re: Finding unclosed Connections (CachedConfigurationManager
          anil.saldhana

          When you close the connection without closing the ResultSet,Statement etc, then JBossJCA does the housekeeping for u.

          If you have left the connection open and wait for things to happen....???

          • 2. Re: Finding unclosed Connections (CachedConfigurationManager

            I read descriptions of flags to detect open ResultSet/Statements, but I'm really concerned with the Connections.

            I'm able to get the InUseConnectionCount (from jmx-console page mentioned in original post) to climb and not seeing any type of notificiation of the app server closing the connection.

            Does this occur when the Thread/Method completes without closing the Connection, or on some type of timer? We've used Orion Server in the past, and it would generate an Exception with the method was completed with an open connection, was hoping JBoss would be able to do the same.

            Thanks

            • 3. Re: Finding unclosed Connections (CachedConfigurationManager

              Moderated: I don't feed TROLLs (reference to Orion when the problem is really just a lack
              of understanding - inability to read the FAQs).


              • 4. Re: Finding unclosed Connections (CachedConfigurationManager

                 

                "adrian@jboss.org" wrote:
                Moderated: I don't feed TROLLs (reference to Orion when the problem is really just a lack
                of understanding - inability to read the FAQs).




                Hey, I'm sorry for mentioning another server, but if you read my reply, I was asking if it worked the same way -- I was not comparing functionality, or singing the merits of it. If I was happy with it, I wouldn't be using JBoss would I? I will refrain from doing so in future posts, but I don't believe me or my post constitutes a "troll".

                You mention I didn't read tha FAQs. Can you elaborate on this? The "FAQ - Read this Second" post in this forum mentions the Debug attribute in the transaction-service.xml. This is not part of JBoss 4.0, so I obviously did some research to make the changes to jbossjca-service.xml (which were already enabled by default).

                In the same post, you mention the track-statements tag in the -ds.xml file. I'm interested in tracking Connections, but would give that a shot if you said it should work. Do you suggest this then?

                As far as the rest of the FAQs, the "READ THIS FIRST" post mentions changing log levels to TRACE in log4j.xml. I asked in my original post if changes were required assuming the feature was turned on. No where I read in the README FAQ posts or Wiki say that this is required in addition to the configuration changes already mentioned.

                I have no problem admitting this is "just a lack of understanding", but where is this addressed in the faqs?

                The default JBoss 4.0.0 settings have the notification of connection leaks on by default. I wrote code that would leave them open, and saw nothing in STDOUT or server.log. I'm probably missing something trivial, but I've done my homework.

                • 5. Re: Finding unclosed Connections (CachedConfigurationManager

                  In the "related" section of the link you provided:
                  http://www.jboss.org/wiki/Wiki.jsp?page=CanJBossTellMeWhenIDontCloseAConnection

                   Servlets and JSP
                  From from 3.2.4 this checking is available in the web layer. Uncomment the following in deploy/jbossweb-xxx.sar/server.xml
                  
                   <!-- Check for unclosed connections -->
                   <Valve className="org.jboss.web.tomcat.tc5.jca.CachedConnectionValve"
                   cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager" />
                  
                  


                  • 6. Re: Finding unclosed Connections (CachedConfigurationManager

                     

                    "adrian@jboss.org" wrote:
                    In the "related" section of the link you provided:
                    http://www.jboss.org/wiki/Wiki.jsp?page=CanJBossTellMeWhenIDontCloseAConnection

                     Servlets and JSP
                    From from 3.2.4 this checking is available in the web layer. Uncomment the following in deploy/jbossweb-xxx.sar/server.xml
                    
                     <!-- Check for unclosed connections -->
                     <Valve className="org.jboss.web.tomcat.tc5.jca.CachedConnectionValve"
                     cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager" />
                    
                    


                    Thanks that is exactley what I was looking for. Problem is that I now get the following Exception. If it helps, I'm running under the default instance.

                    11:14:44,458 ERROR [Catalina] Catalina.start:
                    LifecycleException: javax.management.InstanceNotFoundException: jboss.jca:servi
                    ce=CachedConnectionManager is not registered.
                    at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.start(CachedConnec
                    tionValve.java:179)
                    at org.apache.catalina.core.StandardPipeline.start(StandardPipeline.java
                    :240)
                    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1088)

                    at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
                    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)

                    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478
                    )
                    at org.jboss.web.tomcat.tc5.StandardService.start(StandardService.java:5
                    38)
                    at org.apache.catalina.core.StandardServer.start(StandardServer.java:231
                    3)

                    • 7. Re: Finding unclosed Connections (CachedConfigurationManager

                      jbossweb-xxx.sar/META-INF/jboss-service.xml

                       <!-- Only needed if the org.jboss.web.tomcat.tc5.jca.CachedConnectionValve
                       is enabled in the tomcat server.xml file
                       <depends>jboss.jca:service=CachedConnectionManager</depends>
                       -->
                      


                      Please update the WIKI with anything you think needs clarifying or highlighting.

                      • 8. Re: Finding unclosed Connections (CachedConfigurationManager

                        Thanks, I have updated the Wiki. I haven't read any guidelines to editing wikis, so you might want to review it.

                        Any word on the exception?

                        • 9. Re: Finding unclosed Connections (CachedConfigurationManager

                          ? See the previous post about uncommenting the dependency.

                          • 10. Re: Finding unclosed Connections (CachedConfigurationManager

                            Ok, now I'm getting the following:

                            12:16:12,739 ERROR [Catalina] Catalina.start:
                            LifecycleException: java.lang.NullPointerException: null name
                            at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.start(CachedConnectionValve.java:179)
                            at org.apache.catalina.core.StandardPipeline.start(StandardPipeline.java:240)
                            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1088)
                            at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
                            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
                            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
                            at org.jboss.web.tomcat.tc5.StandardService.start(StandardService.java:538)
                            at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)

                            • 11. Re: Finding unclosed Connections (CachedConfigurationManager

                              I am not a remote debugger. And I am not a mind reader.

                              How would you feel if somebody gave you a NullPointerException
                              without explaining what configuration changes you made or even trying to
                              work it out for themselves?

                              My *guess* is you have fallen foul of this refactoring problem
                              and/or you are trying to use jboss-3.2.4 config (from the wiki) with JBoss4.
                              Correct configuration (at the bottom - note the comment about your previous question
                              i.e. it was already answered 2 months ago):
                              http://cvs.sourceforge.net/viewcvs.py/jboss/jboss-tomcat/src/resources/server.xml?rev=1.3&view=markup

                              This thread is getting way too long and you need to start thinking for yourself
                              so I can get on with some of my own work.

                              You also need to try the latest version (4.0.1 at time of writing)
                              before posting questions/problems.