Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-16252

Wrong initialisation of plugin active objects causes permanent errors on SQL queries

    XMLWordPrintable

Details

    Description

      Behaviour

      When plugin faces exceptional on DB connectivity during startup it will throw the same exception all the time plugin tries to access DB. 

      Sample exception may look as follows:

      2017-08-18 02:44:07,275 ajp-nio-127.0.0.1-8009-exec-25 WARN - 164x48697x1 8ne8wt 10.167.104.246 /browse/***** [c.atlassian.ozymandias.SafePluginPointAccess] Unable to run plugin code because of 'java.lang.reflect.UndeclaredThrowableException - null'.
      2017-08-18 02:44:07,316 ajp-nio-127.0.0.1-8009-exec-25 ERROR - 164x48697x1 8ne8wt 10.167.104.246 /browse/****** [c.a.j.web.component.ModuleWebComponentImpl] An exception occured while rendering the web panel: com.pyxis.greenhopper.jira:greenhopper-agile-issue-web-panel (null)
      java.lang.reflect.UndeclaredThrowableException
      	at com.sun.proxy.$Proxy3133.getSprint(Unknown Source)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.convertDbValueToType(SprintCFType.java:459)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.convertDbValueToType(SprintCFType.java:83)
      ...
      Caused by: java.lang.reflect.InvocationTargetException
      ...
      java.sql.SQLException: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
      	at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.migrate(EntityManagedActiveObjects.java:53)
      	at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory$1.doInTransaction(AbstractActiveObjectsFactory.java:77)
      	at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory$1.doInTransaction(AbstractActiveObjectsFactory.java:72)
      	at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
      	at com.atlassian.jira.DefaultHostContextAccessor.doInTransaction(DefaultHostContextAccessor.java:34)
      ...
      	at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory.create(AbstractActiveObjectsFactory.java:72)
      	at com.atlassian.activeobjects.internal.DelegatingActiveObjectsFactory.create(DelegatingActiveObjectsFactory.java:32)
      	at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects$1$1$1.call(TenantAwareActiveObjects.java:91)
      	... 6 more
      Caused by: java.sql.SQLException: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
      ...
      	at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1845)
      	at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1810)
      	at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:294)
      	at org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
      	at org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
      	at net.java.ao.DatabaseProvider.executeUpdate(DatabaseProvider.java:2238)
      	at net.java.ao.DatabaseProvider.executeUpdateForAction(DatabaseProvider.java:2294)
      	at net.java.ao.DatabaseProvider.executeUpdatesForActions(DatabaseProvider.java:2266)
      	at net.java.ao.schema.SchemaGenerator.migrate(SchemaGenerator.java:91)
      	at net.java.ao.EntityManager.migrate(EntityManager.java:128)
      	at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.migrate(EntityManagedActiveObjects.java:51)
      	... 45 more

      Root cause

      When exception occurs in AO initialisation code it will be cached and returned always. This is effectively breaking all communication with DB for plugin. This is happening in TenantAwareActiveObjects: class as aoPromisesByTenant is caching exception from initialisation. 

      Expected behaviour

      Plugin retries SQL and exception is not permanent. Or Jira is not starting and not allowing plugin to operate without DB connection.

      Workaround

      Restart Jira. 

      Attachments

        Activity

          People

            Unassigned Unassigned
            ajakubowski Adam Jakubowski (Inactive)
            Votes:
            5 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated: