Under certain conditions, fetching the status of a Workbox notification can OOME the server.

      This was observed on OD instance rdcgroup.atlassian.net via ZOOME (link to OOME details

      The truncated stack trace that blows the stack out and causes the OOME is:

      at java.lang.OutOfMemoryError.<init>()V (OutOfMemoryError.java:25)
        at java.util.Arrays.copyOf([CI)[C (Arrays.java:2882)
        [...]
        at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getObject(Ljava/lang/String;)Ljava/lang/Object; (DelegatingResultSet.java:328)
        at net.java.ao.EntityManager.find(Ljava/lang/Class;Ljava/lang/String;Lnet/java/ao/Query;)[Lnet/java/ao/RawEntity; (EntityManager.java:777)
        at net.java.ao.EntityManager.find(Ljava/lang/Class;Lnet/java/ao/Query;)[Lnet/java/ao/RawEntity; (EntityManager.java:675)
        at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.find(Ljava/lang/Class;Lnet/java/ao/Query;)[Lnet/java/ao/RawEntity; (EntityManagedActiveObjects.java:181)
        at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects.find(Ljava/lang/Class;Lnet/java/ao/Query;)[Lnet/java/ao/RawEntity; (TenantAwareActiveObjects.java:335)
        [...]
        at com.atlassian.mywork.host.dao.ao.AONotificationDao.getItemStatus(Lcom/atlassian/mywork/model/Notification;)Lcom/atlassian/mywork/model/Status; (AONotificationDao.java:71)
        at com.atlassian.mywork.host.dao.ao.AONotificationDao.create(Lcom/atlassian/mywork/model/Notification;Ljava/util/Date;)Lcom/atlassian/mywork/model/Notification; (AONotificationDao.java:60)
        at com.atlassian.mywork.host.dao.ao.AONotificationDao.create(Lcom/atlassian/mywork/model/Notification;)Lcom/atlassian/mywork/model/Notification; (AONotificationDao.java:52)
      

      Looking at the calling code in AONotificationDao#getItemStatus, we see:

      for (AONotification other : ao.find(AONotification.class, select().where("USER = ? AND GLOBAL_ID = ?", getStringKeyForUsername(notification.getUser()), globalId)))
      {
         return other.getStatus();
      }
      

      Here we have a for loop that returns from the method on the first loop iteration. However, the call to ao.find is unbounded, and so potentially can return a very large result set. It doesn't matter that the for loop only wants the first one.

      It appears that if a given Notification has a large number of associated AONotifications for that user, then memory usaqe will be high, and may trigger an OOME.

      This method needs to be rewritten to limit the size of the result set to a single item.

            [CONFCLOUD-54315] Fetching workbox notification status causes OOME

            Monique Khairuliana (Inactive) made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5 - TEMP [ 2366328 ] New: JAC Bug Workflow v3 [ 3418767 ]
            Status Original: Resolved [ 5 ] New: Closed [ 6 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5 [ 2255959 ] New: Confluence Workflow - Public Facing - Restricted v5 - TEMP [ 2366328 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5.1 - TEMP [ 2207450 ] New: Confluence Workflow - Public Facing - Restricted v5 [ 2255959 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5 - TEMP [ 2152967 ] New: Confluence Workflow - Public Facing - Restricted v5.1 - TEMP [ 2207450 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5 [ 1908834 ] New: Confluence Workflow - Public Facing - Restricted v5 - TEMP [ 2152967 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v3 [ 1728799 ] New: Confluence Workflow - Public Facing - Restricted v5 [ 1908834 ]
            Matthew Saxby (Inactive) made changes -
            Component/s New: Core - Workbox [ 46334 ]
            Component/s Original: Core - Workbox [ 20291 ]
            Fix Version/s New: 5.7 [ 67750 ]
            Fix Version/s New: 5.7-OD-42-046 [ 67772 ]
            Fix Version/s Original: 5.7 [ 45008 ]
            Fix Version/s Original: 5.7-OD-42-046 [ 51497 ]
            Key Original: CONF-34439 New: CONFCLOUD-54315
            Affects Version/s New: 5.5-OD-28 [ 67732 ]
            Affects Version/s New: 5.5-OD-31-010 [ 67752 ]
            Affects Version/s Original: 5.5-OD-31-010 [ 45694 ]
            Affects Version/s Original: 5.5-OD-28 [ 44201 ]
            Project Original: Confluence [ 10470 ] New: Confluence [ 18513 ]
            Katherine Yabut made changes -
            Workflow Original: CONF Bug Subtask WF (TEMP) [ 1681489 ] New: Confluence Workflow - Public Facing - Restricted v3 [ 1728799 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v2 [ 1570652 ] New: CONF Bug Subtask WF (TEMP) [ 1681489 ]
            Confluence Escalation Bot (Inactive) made changes -
            Labels Original: bugfix_dev_backlog ondemand oome workbox New: affects-cloud bugfix_dev_backlog ondemand oome workbox

              tquanghua Thinh Quang Hua (Inactive)
              kmacleod Kenny MacLeod
              Affected customers:
              1 This affects my team
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: