[#3062] - Concurrent calls to REST API return wrong report

Bug report
Project: Severity:
Component: Reproducibility:
Assigned to:

Using the v2/reports service.
I send two report requests approximately at the same time. Each request is for a different report and as expected, they return a different UUID.
When requesting the report contents, both requests return the same report content.
Here is an example of the two requests that return the same content :
GET /jasperserver-pro/rest/report/29fd1f55-9821-41ed-a6c7-660bf82eb3da?file=report HTTP/1.1
GET /jasperserver-pro/rest/report/5155c0cf-ccc6-4838-92ec-3ea6a204bd94?file=report HTTP/1.1

All of my requests use the same authentication value (using Basic auth).
All of my requests use the same JSESSIONID cookie value, so they share the same HttpSession on the server.
The occurrence of this behavior is sporadic as with most concurrency bugs, but I have higher hit rates when the generated report takes a long time to generate (ex. 5-10 seconds).

So it seems the REST Api doesn't handle concurrent calls to the REST API correctly, and some information is shared across requests leading to this behavior.

Rest v2 report API
p.malouin's picture
Joined: Jul 16 2013 - 6:43am
Last seen: 8 years 6 months ago

1 Comment:

  • Assigned:nobody»

Looking at the source code, I might have found an explanation. The following class:
Is only instantiated once per session within its implementation (LegacyRunReportServiceImpl) :
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
But LegacyRunReportServiceImpl's "attributes" attribute contains the results of the generated report.
Two concurrent calls to this service overwrites the values in this attribute and only the last attribute values are available.

A solution to this would be to change the scope of this class to "request" or to remove the need to store the report generation result inside this class's attribute.