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

Getting HTTP 500 after calling Rest API for Space data

XMLWordPrintable

      Issue Summary

      This is reproducible on Data Center: (yes)

      Confluence returns HTTP 500 while calling the below REST API endpoint if the instance has more than 1 space.

      <Confluence Base URL>/rest/api/search?cql=type=space&expand=space.metadata.labels,space.homepage
      

      Steps to Reproduce

      1. Create a Confluence 8.5.12 version
      2. Create 2 spaces on Confluence
      3. Send a GET request to the below URL;
        <Confluence Base URL>/rest/api/search?cql=type=space&expand=space.metadata.labels,space.homepage
        
      4. Getting HTTP 500 message and in the application logs there is below stack trace;
        2024-07-18 07:12:19,393 ERROR [http-nio-8090-exec-3 url: /confluence/rest/api/search; user: admin] [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error :
         -- url: /confluence/rest/api/search | userName: admin | traceId: cf5bbc493df02390
        com.atlassian.confluence.api.impl.pagination.BatchExecutionException: Error during batch execution with session management
        	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.executeBatchWithSessionManagement(PaginationServiceImpl.java:281)
        	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.lambda$doRequestInTransaction$1(PaginationServiceImpl.java:263)
        	at com.atlassian.confluence.api.impl.ReadOnlyAndReadWriteTransactionConversionTemplate.executeInReadOnly(ReadOnlyAndReadWriteTransactionConversionTemplate.java:38)
        	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.doRequestInTransaction(PaginationServiceImpl.java:261)
        . . .
        Caused by: org.hibernate.HibernateException: Unable to resolve owner of loading collection [[com.atlassian.confluence.core.ContentEntityObject.contentProperties#394111]] for second level caching
        	at org.hibernate.engine.loading.internal.CollectionLoadContext.addCollectionToCache(CollectionLoadContext.java:360)
        	at org.hibernate.engine.loading.internal.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:299)
        	at org.hibernate.engine.loading.internal.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:224)
        	at org.hibernate.engine.loading.internal.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:198)
        	at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:1257)
        	at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1214)
        

      The issue is only reproducible while using space.metadata.labels and space.homepage expand parameters at the same time. Confluence responds without any problem while using these parameters independently.

      Expected Results

      The space information should be listed after calling the URL.

      Actual Results

      Getting HTTP 500 after calling the Rest API endpoint.

      Workaround

      Option 1: Using space.metadata.labels and space.homepage parameters independently like below;

      <Confluence Base URL>/rest/api/search?cql=type=space&expand=space.homepage
      <Confluence Base URL>/rest/api/search?cql=type=space&expand=space.metadata.labels
      

      Option 2: Using limit and start parameters to get only 1 space data from Rest API;

      <Confluence Base URL>/rest/api/search?cql=type=space&expand=space.metadata.labels,space.homepage&limit=1&start=0
      

              854eef6f5746 Kusal Kithul-Godage
              ae95049760ab Kaan Çalışkan (Inactive)
              Votes:
              54 Vote for this issue
              Watchers:
              70 Start watching this issue

                Created:
                Updated:
                Resolved: