microsoft / microsoft/fhir-server
Queries with large result sets and multiple _revinclude parameters result in Internal server error
Nobody has claimed this yet.
- Dominant language
- TSQL
- Stars
- 1.4k
- Forks
- 592
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 41
Description
**Describe the bug**
When performing a search with more than one _revinclude search parameter and _count set to a largish value (on our server anything 100 or above seems to be enough), the server returns 500 Internal server error. Reproduced in two of our testing environments with different datasets.
The exception in the AI logs states '_The count must be greater than zero.'_ A stack trace is attached.
**FHIR Version?**
R4
**Data provider?**
CosmosDB
**To Reproduce**
Steps to reproduce the behavior:
1. Perform a search as described, for instance /Practitioner/?_count=1000&_revinclude=Contract:subject&_revinclude=Person:practitioner
**Expected behavior**
The server returns a set of search result, marked as Incomplete if all of the _revinclude data is not present. When only a single _revinclude statement is used, this is the behavior we see.
**Actual behavior**
The server returns 500 Internal server error
[exception_stacktrace.txt](https://github.com/microsoft/fhir-server/files/9988827/exception_stacktrace.txt)
AB#98330
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the request at /Practitioner/?_count=1000&_revinclude=Contract:subject&_revinclude=Person:practitioner against the CosmosDB setup, then inspect the attached exception_stacktrace.txt. Confirm the failure path for multiple _revinclude parameters and large _count values; done means the request returns search results, marked Incomplete when appropriate, instead of HTTP 500.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100