-
Type:
Suggestion
-
Resolution: Fixed
-
Component/s: FC - Ecosystem - API Framework
Issue Summary
Customers can get back 500 errors when bulk fetching attachments due to timeouts when fetching results. We had a previous ticket https://jira.atlassian.com/browse/CONFCLOUD-78425 that was for a similar issue that was partially addressed. This ticket is to have a more comprehensive fix for the timeout issue - which involves returning whatever results the backend managed to fetch, even if the number of results is less than the limit specified.
Note that the reason that the backend may time out for a large limit is due to certain filters (such as permissions checks) that occur after a query is issued to the Database, requiring further queries to fill up the result set up to the value specified by limit. In pathological case, this can end up taking a large time due to a very large percentage of results being filtered out after fetching from the Database, requiring many iterations of Database queries to fill up the result set, which may ultimately result in timeout.
Note that this issue is valid for other v2 APIs that return a list of results, e.g. Get pages.
Steps to reproduce
- Perform an API call through the browser or through other tools like Postman https://instance.atlassian.net/wiki/api/v2/attachments?limit=250
Where user making a request doesn't have access to a large number of attachments
Expected Results
API returns the results
Actual Results
The API call returns an internal error status code 500 result
Workaround
Workaround is to specify a smaller limit when fetching attachments to enable fetching of some results without timing out.
Example:
/wiki/api/v2/attachments?limit=125
instead of
/wiki/api/v2/attachments?limit=250