Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-24847

Email notification sent while shutdown is in progress results in an IllegalStateException stack trace in the email

    XMLWordPrintable

Details

    Description

      Somehow, an email notification from JIRA was sent after a shutdown of the app was initiated. This resulted in me receiving an email containing a stack trace:

      An error occurred whilst rendering this message.  Please contact the administrators, and inform them of this bug.
      
      Details:
      -------
      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'formatUser' in  class com.atlassian.jira.plugin.profile.DefaultUserFormatManager threw exception class java.lang.IllegalStateException : No implementation has been registered for this tenant, and there's no creator to create it
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:251)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:70)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
      	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:171)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:70)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
      	at org.apache.velocity.runtime.directive.Parse.render(Parse.java:181)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
      	at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:300)
      	at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:202)
      	at com.atlassian.velocity.DefaultVelocityManager.getEncodedBodyForContent(DefaultVelocityManager.java:143)
      	at com.atlassian.jira.mail.MailingListCompiler$1.processRecipient(MailingListCompiler.java:289)
      	at com.atlassian.jira.mail.NotificationRecipientProcessor.process(NotificationRecipientProcessor.java:39)
      	at com.atlassian.jira.mail.MailingListCompiler.addMailsToQueue(MailingListCompiler.java:311)
      	at com.atlassian.jira.mail.MailingListCompiler.access$400(MailingListCompiler.java:36)
      	at com.atlassian.jira.mail.MailingListCompiler$NotificationCompiler.addEmailsToQueue(MailingListCompiler.java:456)
      	at com.atlassian.jira.mail.MailingListCompiler$NotificationCompiler.sendLists(MailingListCompiler.java:426)
      	at com.atlassian.jira.mail.MailingListCompiler$NotificationCompiler.sendForEvent(MailingListCompiler.java:379)
      	at com.atlassian.jira.mail.MailingListCompiler.sendLists(MailingListCompiler.java:129)
      	at com.atlassian.jira.mail.IssueMailQueueItem.send(IssueMailQueueItem.java:151)
      	at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:66)
      	at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:23)
      	at com.atlassian.jira.service.services.mail.MailQueueService.destroy(MailQueueService.java:43)
      	at com.atlassian.jira.service.JiraServiceContainerImpl.destroy(JiraServiceContainerImpl.java:96)
      	at com.atlassian.jira.upgrade.ConsistencyCheckImpl.destroy(ConsistencyCheckImpl.java:68)
      	at com.atlassian.jira.upgrade.ConsistencyLauncher.stop(ConsistencyLauncher.java:85)
      	at com.atlassian.jira.startup.DefaultJiraLauncher.stop(DefaultJiraLauncher.java:51)
      	at com.atlassian.jira.startup.LauncherContextListener$2.destroy(LauncherContextListener.java:69)
      	at com.atlassian.jira.startup.LauncherContextListener$2.destroy(LauncherContextListener.java:62)
      	at com.atlassian.multitenant.impl.MultiTenantComponentMapImpl.onTenantStop(MultiTenantComponentMapImpl.java:177)
      	at com.atlassian.multitenant.impl.DefaultMultiTenantManager$2.consume(DefaultMultiTenantManager.java:169)
      	at com.atlassian.multitenant.impl.DefaultMultiTenantManager$2.consume(DefaultMultiTenantManager.java:164)
      	at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForEachListener(DefaultMultiTenantManager.java:256)
      	at com.atlassian.multitenant.impl.DefaultMultiTenantManager.stopTenant(DefaultMultiTenantManager.java:163)
      	at com.atlassian.multitenant.impl.DefaultMultiTenantManager.stopAll(DefaultMultiTenantManager.java:211)
      	at com.atlassian.jira.startup.LauncherContextListener.contextDestroyed(LauncherContextListener.java:136)
      	at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3805)
      	at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4357)
      	at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:893)
      	at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1180)
      	at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1151)
      	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:313)
      	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
      	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1055)
      	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1067)
      	at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
      	at org.apache.catalina.core.StandardService.stop(StandardService.java:510)
      	at org.apache.catalina.core.StandardServer.stop(StandardServer.java:734)
      	at org.apache.catalina.startup.Catalina.stop(Catalina.java:602)
      	at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:645)
      

      For one thing, emails should not be sent after a shutdown has started (or, alternately, the shutdown process should wait for queued notifications to be flushed).

      Secondly, if an error occurs while rendering an email, we could probably do better than emailing the recipient an ugly stack trace. See the attached screen shot for how this appears to the end user.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tmoore Tim Moore [Atlassian]
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: