{"id":3243,"date":"2013-08-14T20:03:40","date_gmt":"2013-08-15T01:03:40","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=3243"},"modified":"2013-08-14T20:03:40","modified_gmt":"2013-08-15T01:03:40","slug":"jboss-which-threads-have-a-database-connection-checked-out-of-the-pool","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2013\/08\/14\/jboss-which-threads-have-a-database-connection-checked-out-of-the-pool\/","title":{"rendered":"JBOSS &#8211; Which threads have a database connection checked out of the pool?"},"content":{"rendered":"<p>We had an issue in ATG which was eventually traced to deadlocked sessions on checkout, each of which was attempting to decrement inventory for SKU&#8217;s in opposite order.<\/p>\n<p>In other words, session one wanted to decrement inventory for A and B, and session 2 wanted to decrement inventory for SKU&#8217;s B and A.<\/p>\n<p>Session 1 locked A, but couldn&#8217;t lock B, and session 2 locked B, but couldn&#8217;t lock A.<\/p>\n<p>The only way we could track this down was to look at the evaporating pool of connections to the database.\u00a0 When we did this, we saw the issue immediately.<\/p>\n<ol>\n<li>On the jmx-console of the server of interest, enabled debug on the jboss.jca CachedConnectionManager component<\/li>\n<li>Invoke the listInUseConnections bean method on the CachedConnectionManager component<\/li>\n<li>You will see a stack trace for each thread that has a connection checked out of the pool<\/li>\n<li>Look for a pattern in the stack traces for which class may be leaking connection handles<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>We had an issue in ATG which was eventually traced to deadlocked sessions on checkout, each of which was attempting to decrement inventory for SKU&#8217;s in opposite order. In other words, session one wanted to decrement inventory for A and&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2013\/08\/14\/jboss-which-threads-have-a-database-connection-checked-out-of-the-pool\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[48,37,38,49],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3243"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3243"}],"version-history":[{"count":12,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3243\/revisions"}],"predecessor-version":[{"id":3258,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3243\/revisions\/3258"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3243"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}