Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-5281

JIRA Bamboo Plugin creates deadlock in JIRA and Bamboo applications when starting them up in the same Tomcat server

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • High
    • 2.6 M3, 2.6
    • 2.5.1
    • JIRA integration
    • None

    Description

      Steps to reproduce:

      1. Deploy JIRA 4.0.1 WAR into Tomcat 5.5.26
      2. Deploy Bamboo 2.5.1 WAR into same Tomcat
      3. Configure everything normally
      4. Start up JIRA. Default configuration. Create TST project.
      5. Start up Bamboo. Express Installation.
      6. In JIRA, configure a Bamboo Server for the Bamboo app
      7. Shutdown Tomcat
      8. Restart Tomcat

      Bamboo gets this far:

      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: <user> <url> <starting memory free (kb)> +- <difference in free mem (kb)> <query time (ms)>
      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

      JIRA initialisation gets this far:

      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

      Tomcat logs show that Tomcat has hung after the plugins system has been initialised:

      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

      Neither JIRA or Bamboo webapps can be accessed through the browser. Thread dump of Tomcat shows the following stack trace:

      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)

      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:

          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();
              }
          }
      

      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.

      Attachments

        Activity

          People

            bmccoy bmccoy
            mtokar Michael Tokar
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 20h
                20h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 8h Time Not Required
                8h