Uploaded image for project: 'Jira Cloud'
  1. Jira Cloud
  2. JRACLOUD-61543

Outgoing Mail Stopped Working due to Large Group Filter Subscription




      NOTE: This bug report is for JIRA Cloud. Using JIRA Server? See the corresponding bug report.


      JIRA Outgoing mail stop sending mails out to users for roughly 4 hours when it is processing Group Filter Subscription with the particular group has more than 1700 users.


      • 500,000 issues
      • 2000 users
      • SMTP outgoing mail configured

      Steps to Reproduce

      1. Create a JQL filter that uses currentUser() function
      2. Has a group that consist of 1700 users
      3. Set a Group Filter Subscription to use the group and JQL filter created


      Generating thread dumps when Mail queue is stuck show long running thread of the following:

      "Sending mailitem com.atlassian.jira.mail.SubscriptionMailQueueItem owner: 'username(username)'" #110 prio=4 os_prio=-1 tid=0x0000000085c7e800 nid=0x1640 runnable [0x000000008fb1e000]
         java.lang.Thread.State: RUNNABLE
      	at org.apache.lucene.index.SegmentTermDocs.read(SegmentTermDocs.java:157)
      	at org.apache.lucene.search.MultiTermQueryWrapperFilter.getDocIdSet(MultiTermQueryWrapperFilter.java:122)
      	at org.apache.lucene.search.ConstantScoreQuery$ConstantWeight.scorer(ConstantScoreQuery.java:139)
      	at org.apache.lucene.search.BooleanQuery$BooleanWeight.scorer(BooleanQuery.java:298)
      	at org.apache.lucene.search.IndexSearcher.searchWithFilter(IndexSearcher.java:542)
      	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:532)
      	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:463)
      	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:433)
      	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:356)
      	at com.atlassian.jira.index.DelegateSearcher.search(DelegateSearcher.java:165)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.runSearch(LuceneSearchProvider.java:566)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getHits(LuceneSearchProvider.java:294)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:421)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:413)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:104)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:92)
      	at com.atlassian.jira.mail.SubscriptionMailQueueItem.getContextParams(SubscriptionMailQueueItem.java:336)
      	at com.atlassian.jira.mail.SubscriptionMailQueueItem.sendSearchRequestEmail(SubscriptionMailQueueItem.java:174)
      	at com.atlassian.jira.mail.SubscriptionMailQueueItem.send(SubscriptionMailQueueItem.java:126)
      	at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:66)

      Expected Results

      Outgoing mail continue to send out while Group Filter Subscription is processing the mails to be added in the Mail queue

      Actual Results

      Mail queue is stuck, no outgoing mail is send. Manually flushing mail queue does not work.


      Filter Subscription that will generate the mails for each users will obtain a lock on the Mail queue on MailQueueImpl#addItem. The mail sender couldn't take lock for MailQueueImpl#sendBuffer to send those mails that already in the Mail queue due to it being locked by Filter subscription.


      Depending on use-case:

      1. Set Group Filter Subscription to use a group that has a smaller user count <200 users.
      2. Create a mailing list in Mail Server to be configured for the Filter Subscription. Create a dummy user in JIRA to be assign with the mailing list and the user will be the one subscribing to the Filter Subscription. Users who should be receiving mail subscription needs to be part of the mailing list.


        Issue Links



              ohookins@atlassian.com Oliver Hookins (Inactive)
              znoorsazali Zul NS [Atlassian]
              1 Vote for this issue
              9 Start watching this issue