Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-56148

Intermittent NPE errors when using one or more Page Property Macro or any other macro

    XMLWordPrintable

Details

    Description

      Atlassian Update - October 2020

      We understand that this is an important issue and we will be backporting it to a 7.4 bugfix version. We need to wait some time after bugfixes have been released in our newer versions before backporting to ensure the stability of our LTS releases.
      We are currently targeting the next version 7.4.6 for this backport, which is scheduled for release in late November.

      Summary

      Seeing intermittent NPE and System Errors on a Page Properties Report Macro page. The page doesn't load and redirects to a 500 error page.
      It is also possible to encounter this bug through a different macro that uses the same code path and throws the same underlying error.

      Steps to Reproduce

      1. Download and restore PPM1space.xml.zip to a Confluence instance
        • This space XML provide 900 pages that contains Page Properties Macro with label "discussions"
        • One of the page (titled "1") contains an image that will be fetched by the Page Properties Report Macro
      2. Download and restore PPM2space.xml.zip
        • This space contains a page with Page Properties Report Macro that fetches all pages in this site, labeled "decisions"
      3. Go to PPM2 > Page Properties Report Macro page

      Expected Results

      All pages are fetched as expected

      Actual Results

      Seeing Intermittent errors on this page, on each reload.
      The errors initially doesn't give us more details as the JVM might me ommitting the stacktrace as part of

      2019-01-03 14:45:24,397 ERROR [http-nio-8443-exec-2 url:/display/AAAAAA username:some-user url:/pages/viewpage.action username:some-user] [xhtml.view.macro.ViewMacroMarshaller] handleMacroExecutionException Error rendering macro: detailssummary
       -- url: /display/AAAAAA | page: 420525059 | traceId: bfa1b75efe717c31 | userName: some-user | referer: https://confluence-base-url/display/AAAAAA | action: viewpage
      java.lang.NullPointerException
      

      In order to inspect the full stack trace, we need to disable the JVM optimization by adding the following JVM argument

      -XX:-OmitStackTraceInFastThrow
      

      The full stacktrace looks like this:

      2019-01-15 14:50:05,276 ERROR [http-nio-8443-exec-4 url:/pages/viewpage.action username:some-user ] [xhtml.view.macro.ViewMacroMarshaller] handleMacroExecutionException Error rendering macro: detailssummary
       -- url: /pages/viewpage.action | page: 374370875 | traceId: c285cc1c66d92529 | userName: some-user | referer: https://confluence-base-url/login.action?os_destination=%2Fpages%2Fviewpage.action%3FspaceKey%3DISAAAE%26title%3DAAAAA%2Bfollowup&permissionViolation=true | action: viewpage
      java.lang.NullPointerException
      	at org.hibernate.event.internal.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:138)
      	at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:74)
      	at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:44)
      	at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1389)
      	at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1474)
      	at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1441)
      	at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1410)
      	at com.atlassian.confluence.spaces.persistence.dao.hibernate.HibernateSpaceDao.lambda$findSpaceKeysWithStatus$6(HibernateSpaceDao.java:335)
      	at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:359)
      	at org.springframework.orm.hibernate5.HibernateTemplate.execute(HibernateTemplate.java:313)
      	at com.atlassian.confluence.spaces.persistence.dao.hibernate.HibernateSpaceDao.findSpaceKeysWithStatus(HibernateSpaceDao.java:331)
      	at com.atlassian.confluence.spaces.DefaultSpaceManager.getAllSpaceKeys(DefaultSpaceManager.java:773)
      	at sun.reflect.GeneratedMethodAccessor1148.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:16)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	at com.atlassian.confluence.util.profiling.ConfluenceMonitoringMethodInterceptor.invoke(ConfluenceMonitoringMethodInterceptor.java:34)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
      	at com.sun.proxy.$Proxy92.getAllSpaceKeys(Unknown Source)
      	at com.atlassian.confluence.search.v2.lucene.mapper.ArchivedSpacesSearchFilterMapper.convertToLuceneSearchFilter(ArchivedSpacesSearchFilterMapper.java:17)
      	at com.atlassian.confluence.search.v2.lucene.mapper.ArchivedSpacesSearchFilterMapper.convertToLuceneSearchFilter(ArchivedSpacesSearchFilterMapper.java:12)
      	at com.atlassian.confluence.search.v2.lucene.DelegatingLuceneSearchMapper.convertToLuceneSearchFilter(DelegatingLuceneSearchMapper.java:68)
      	at com.atlassian.confluence.search.v2.lucene.mapper.BooleanSearchFilterMapper.lambda$convertToLuceneSearchFilter$0(BooleanSearchFilterMapper.java:18)
      	at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1553)
      	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
      	at com.atlassian.confluence.search.v2.lucene.mapper.BooleanSearchFilterMapper.convertToLuceneSearchFilter(BooleanSearchFilterMapper.java:18)
      	at com.atlassian.confluence.search.v2.lucene.mapper.BooleanSearchFilterMapper.convertToLuceneSearchFilter(BooleanSearchFilterMapper.java:10)
      	at com.atlassian.confluence.search.v2.lucene.DelegatingLuceneSearchMapper.convertToLuceneSearchFilter(DelegatingLuceneSearchMapper.java:68)
      	at com.atlassian.confluence.search.v2.lucene.LuceneSearchManager.toLuceneFilter(LuceneSearchManager.java:244)
      	at com.atlassian.confluence.search.v2.lucene.LuceneSearchManager.search(LuceneSearchManager.java:146)
      	at sun.reflect.GeneratedMethodAccessor1018.invoke(Unknown Source)
      ....
      

      The same behavior could cause the following stacktrace as well:

      Cause
      java.lang.NullPointerException
          at org.hibernate.engine.internal.StatefulPersistenceContext.clear(StatefulPersistenceContext.java:234)
      

      or

      Cause
      org.springframework.orm.hibernate.HibernateSystemException: Found shared references to a collection: com.atlassian.confluence.spaces.Space.permissions; nested exception is net.sf.hibernate.HibernateException: Found shared references to a collection: com.atlassian.confluence.spaces.Space.permissions
          at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:597)
      
      caused by: net.sf.hibernate.HibernateException: Found shared references to a collection: com.atlassian.confluence.spaces.Space.permissions
          at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:147)
      

      or

      Cause
      org.springframework.orm.hibernate.HibernateSystemException: Found shared references to a collection: com.atlassian.confluence.core.ContentEntityObject.outgoingLinks; nested exception is net.sf.hibernate.HibernateException: Found shared references to a collection: com.atlassian.confluence.core.ContentEntityObject.outgoingLinks
          at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:597)
      
      caused by: net.sf.hibernate.HibernateException: Found shared references to a collection: com.atlassian.confluence.core.ContentEntityObject.outgoingLinks
          at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:147)
      

      Watch the gif for more info:

      Notes

      The following points are observed:

      1. Issue is more pertinent when the PPRM filter is above 200
      2. Issue is observed when the PPRM is calling any sort of rich content (images, plugins, macros,etc)
      3. Issue is not observed yet with PPRM located in the same space as the pages with the PPM
      4. Issue is not observed when the image/rich content is removed
      5. Page Properties Report Caches are already on 50% utilization

      Cause

      This issue is caused by a hibernate bug tracked here https://hibernate.atlassian.net/browse/HHH-7867. Some work has been done to alleviate and fix a part of this which can be found here https://hibernate.atlassian.net/browse/HHH-10562.

      Workaround

      There is nothing much we can do on our side until this bug is fixed on hibernate side. However, some users were able to avoid this by reducing the amount of Page Properties Macro fetched to 50 or below.

      Attachments

        1. PPM1space.xml.zip
          2.09 MB
        2. PPM2space.xml.zip
          4 kB
        3. z0Qt3emhop.gif
          z0Qt3emhop.gif
          2.41 MB

        Issue Links

          Activity

            People

              dluong Duy Truong Luong
              mkhairuliana Monique Khairuliana (Inactive)
              Votes:
              50 Vote for this issue
              Watchers:
              68 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: