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

Outgoing Mail Stopped Working due to Large Group Filter Subscription

XMLWordPrintable

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

      Summary

      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.

      Environment

      • 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

      Diagnostic

      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)
      

      Notice that an entry is logged to atlassian-jira.log, showing the number of recipients on the subscription that was triggered, if it is above 30:

      2024-08-15 12:00:01,501-0400 Sending mailitem com.atlassian.jira.mail.SubscriptionMailQueueItem id: '100001' owner: 'myuser' INFO anonymous    Mail Queue Service [c.a.jira.mail.SubscriptionMailQueueItem] Sending subscription '100001' of filter '123123' to 987 recipients.
      

      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.

      Notes

      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.

      Workaround

      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.

              Unassigned Unassigned
              znoorsazali Zul NS [Atlassian]
              Votes:
              29 Vote for this issue
              Watchers:
              34 Start watching this issue

                Created:
                Updated: