Concurrent access to the mail task queue can cause sustained high CPU

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Medium
    • None
    • Affects Version/s: 9.2.13
    • Component/s: Core - Email
    • 1
    • Severity 3 - Minor

      Issue Summary

      Confluence queues outgoing email on a single shared mail task queue. AbstractTaskQueue stores information about each queued task in a WeakHashMap field. When many components add tasks to the mail queue from different threads at the same moment, the affected threads can loop forever inside WeakHashMap. They stay RUNNABLE and each uses a full CPU core until the node is restarted. Emails queued on that node may also stop being sent.

      Steps to Reproduce

      This is a timing-dependent concurrency defect.

      1. Set up a Confluence Data Center node with outgoing mail configured.
      2. Create a burst of notifications from several sources at once. For example:
        1. trigger Team Calendars notifications for a calendar with a large audience
        2. at the same time, purge content from the trash in parallel through the REST API, and send other page notifications
      3. Repeat until the race occurs. It depends on timing.
      4. Take several thread dumps a few seconds apart.

        Expected Results

        All tasks are queued, the threads finish, and the map size matches the queue size.

        Actual Results

        Some threads never finish. They stay RUNNABLE and keep using CPU.

        ...
        

        Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

              Assignee:
              Unassigned
              Reporter:
              Pille Saral
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: