Project: bamboo
Issue BAM-5281: JIRA Bamboo Plugin creates deadlock in JIRA and Bamboo applications when starting them up in the same Tomcat server
Steps to reproduce: # Deploy JIRA 4.0.1 WAR into Tomcat 5.5.26 # Deploy Bamboo 2.5.1 WAR into same Tomcat # Configure everything normally # Start up JIRA. Default configuration. Create TST project. # Start up Bamboo. Express Installation. # In JIRA, configure a Bamboo Server for the Bamboo app # Shutdown Tomcat # Restart Tomcat Bamboo gets this far: {quote} 2010-02-04 16:06:03,522 INFO [main] [BambooSmackClient] No IM server specified. Bambo Smack client not initiated. 2010-02-04 16:06:03,573 INFO [main] [BambooContainer] Registered Event Listener: completedBuildNotificationEventListener 2010-02-04 16:06:03,591 INFO [main] [BambooContainer] Registered Event Listener: afterXFailedNotificationListener 2010-02-04 16:06:03,597 INFO [main] [BambooContainer] Registered Event Listener: buildCommentedNotificationListener 2010-02-04 16:06:03,601 INFO [main] [BambooContainer] Registered Event Listener: buildHungNotificationListener 2010-02-04 16:06:03,605 INFO [main] [BambooContainer] Registered Event Listener: buildQueueTimeoutNotificationListener 2010-02-04 16:06:03,608 INFO [main] [BambooContainer] Registered Event Listener: legacyNotificationEventListener 2010-02-04 16:06:03,612 INFO [main] [BambooContainer] Registered Event Listener: buildErrorNotificationListener 2010-02-04 16:06:03,616 INFO [main] [BambooContainer] Registered Event Listener: buildMissingCapableAgentNotificationListener 2010-02-04 16:06:03,620 INFO [main] [BambooContainer] Registered Event Listener: serverStartedEventListener 2010-02-04 16:06:03,620 INFO [main] [BambooContainer] Initialising builds... 2010-02-04 16:06:03,630 INFO [main] [BambooContainer] Checking build repository configurations... 2010-02-04 16:06:03,634 INFO [main] [BambooContainer] Bamboo version 2.5.1 initialised OK 2010-02-04 16:06:03,634 INFO [main] [BambooContainer] Using bamboo.home: /Users/mtokar/support/JSP-51856/bamboohome 2010-02-04 16:06:03,636 INFO [main] [AccessLogFilter] AccessLogFilter initialized. Format is: +- 2010-02-04 16:06:03,642 INFO [main] [[/bamboo]] org.tuckey.web.filters.urlrewrite.utils.Log ERROR: logLevelConf: null 2010-02-04 16:06:03,665 INFO [main] [[/bamboo]] org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: loaded (conf ok) 2010-02-04 16:06:03,748 INFO [main] [[/bamboo]] [CompressingFilter/1.4] CompressingFilter has initialized {quote} JIRA initialisation gets this far: {quote} Database configuration OK ___ Database Configuration _______ Loading entityengine.xml from : file:/Users/mtokar/support/JSP-51856/apache-tomcat-5.5.26/webapps/jira/WEB-INF/classes/entityengine.xml Entity model data source name : defaultDS Entity model field type name : hsql Entity model schema name : PUBLIC Database Version : HSQL Database Engine - 1.8.0 Database Driver : HSQL Database Engine Driver - 1.8.0 Database URL : jdbc:hsqldb:/Users/mtokar/support/JSP-51856/atlassian-jira-enterprise-4.0.1/database/jiradb Database JNDI address : java:comp/env/jdbc/JiraDS {quote} Tomcat logs show that Tomcat has hung after the plugins system has been initialised: {quote} 4/02/2010 16:06:17 com.atlassian.plugin.osgi.factory.UnrecognizedModuleDescriptorServiceTrackerCustomizer addingService INFO: Turned plugin module com.atlassian.streams.streams-jira-plugin:streamsActivityProvider into module com.atlassian.streams.streams-jira-plugin:streamsActivityProvider (null) 4/02/2010 16:06:26 com.atlassian.plugin.loaders.ScanningPluginLoader loadAllPlugins INFO: No plugins found to be deployed 4/02/2010 16:06:26 com.atlassian.plugin.manager.DefaultPluginManager init INFO: Plugin system started in 0:00:19.183 {quote} Neither JIRA or Bamboo webapps can be accessed through the browser. Thread dump of Tomcat shows the following stack trace: {quote} Thread t@81667: (state = IN_NATIVE) - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Interpreted frame) - java.net.SocketInputStream.read(byte[], int, int) @bci=84, line=129 (Interpreted frame) - java.io.BufferedInputStream.fill() @bci=175, line=218 (Compiled frame) - java.io.BufferedInputStream.read() @bci=12, line=235 (Compiled frame) - org.apache.commons.httpclient.HttpParser.readRawLine(java.io.InputStream) @bci=36, line=77 (Interpreted frame) - org.apache.commons.httpclient.HttpParser.readLine(java.io.InputStream, java.lang.String) @bci=11, line=105 (Interpreted frame) - org.apache.commons.httpclient.HttpConnection.readLine(java.lang.String) @bci=19, line=1115 (Interpreted frame) - org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(java.lang.String) @bci=12, line=1373 (Interpreted frame) - org.apache.commons.httpclient.HttpMethodBase.readStatusLine(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection) @bci=36, line=1832 (Interpreted frame) - org.apache.commons.httpclient.HttpMethodBase.readResponse(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection) @bci=16, line=1590 (Interpreted frame) - org.apache.commons.httpclient.HttpMethodBase.execute(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection) @bci=68, line=995 (Interpreted frame) - org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(org.apache.commons.httpclient.HttpMethod) @bci=138, line=397 (Interpreted frame) - org.apache.commons.httpclient.HttpMethodDirector.executeMethod(org.apache.commons.httpclient.HttpMethod) @bci=291, line=170 (Interpreted frame) - org.apache.commons.httpclient.HttpClient.executeMethod(org.apache.commons.httpclient.HostConfiguration, org.apache.commons.httpclient.HttpMethod, org.apache.commons.httpclient.HttpState) @bci=115, line=396 (Interpreted frame) - org.apache.commons.httpclient.HttpClient.executeMethod(org.apache.commons.httpclient.HttpMethod) @bci=14, line=324 (Interpreted frame) - com.atlassian.jira.plugin.ext.bamboo.BambooServerManagerImpl.isGadgetAvailable(java.net.URI) @bci=17, line=413 (Interpreted frame) - com.atlassian.jira.plugin.ext.bamboo.BambooServerManagerImpl.addGadgetsForServer(com.atlassian.jira.plugin.ext.bamboo.service.BambooServer) @bci=63, line=376 (Interpreted frame) - com.atlassian.jira.plugin.ext.bamboo.BambooServerManagerImpl.start() @bci=36, line=117 (Interpreted frame) - com.atlassian.sal.jira.lifecycle.JiraLifecycleManager.notifyOnStart() @bci=99, line=83 (Interpreted frame) - com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.start() @bci=15, line=50 (Interpreted frame) - com.atlassian.sal.jira.lifecycle.JiraLifecycleManager.onJiraStart(com.atlassian.jira.extension.JiraStartedEvent) @bci=9, line=60 (Interpreted frame) {quote} So what we have is a deadlock. Bamboo is somewhat started up but not responding to HTTP requests. JIRA has started its plugins, and in the starting of the JIRA Bamboo Plugin, some code tries to eagerly instantiate something in {{BambooServerManagerImpl.java}}: {code} protected boolean isGadgetAvailable(URI uri) { HeadMethod method = new HeadMethod(uri.toString()); try { httpClient.executeMethod(method); return method.getStatusCode() < HTTP_STATUS_CODE_ERRORS; } catch(IOException e) { return false; } finally { method.releaseConnection(); } } {code} i.e. JIRA is waiting on Bamboo to respond. This should be fixed so that the attempted HTTP connection at least has a sensible timeout (60seconds?) before it gives up and moves along. That, or instantiate things not on the startup of a plugin but at a different point in the lifecycle.
Story points: 5