You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When invoking a GET /Patient?identifier=a,b,c,d,... with a high number of search values, then hapi does not respond at all and runs into a timeout.
There seems to be a limit for values to pass as the search works about equally fast for ~20 identifiers, but adding then a single more results in the erronous behavior.
To Reproduce
The problem exists on version 6.10, but the issue is reproducible with the latest version (7.7 - http://hapi.fhir.org/baseR4) as well.
Additional context
According to the hibernate debug logs on local reproduction with 20 identifiers, there are three Search entititys (ca.uhn.fhir.jpa.entity.Search), for myVersion=1; myVersion=2; and myVersion=3.
If one more identifier is added to the search, 21 identifiers in total, there are 237 of these Search entities printed (myVersion=1; [...]; myVersion=237) before the following exception stops the seemingly endless loop:
ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HAPI-1163: Request timed out after 60070ms
at ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl.getResources(SearchCoordinatorSvcImpl.java:284)
at ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider.doSearchOrEverything(PersistedJpaBundleProvider.java:258)
at ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider.getResources(PersistedJpaBundleProvider.java:380)
at ca.uhn.fhir.jpa.search.PersistedJpaSearchFirstPageBundleProvider.getResources(PersistedJpaSearchFirstPageBundleProvider.java:109)
at ca.uhn.fhir.rest.server.method.ResponseBundleBuilder.pagingBuildResourceList(ResponseBundleBuilder.java:160)
at ca.uhn.fhir.rest.server.method.ResponseBundleBuilder.buildResponsePage(ResponseBundleBuilder.java:112)
at ca.uhn.fhir.rest.server.method.ResponseBundleBuilder.buildResponseBundle(ResponseBundleBuilder.java:57)
at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.doInvokeServer(BaseResourceReturningMethodBinding.java:201)
at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.invokeServer(BaseResourceReturningMethodBinding.java:275)
at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:1190)
at ca.uhn.fhir.rest.server.RestfulServer.doGet(RestfulServer.java:420)
at ca.uhn.fhir.rest.server.RestfulServer.service(RestfulServer.java:1923)
The text was updated successfully, but these errors were encountered:
Describe the bug
When invoking a GET /Patient?identifier=a,b,c,d,... with a high number of search values, then hapi does not respond at all and runs into a timeout.
There seems to be a limit for values to pass as the search works about equally fast for ~20 identifiers, but adding then a single more results in the erronous behavior.
To Reproduce
The problem exists on version 6.10, but the issue is reproducible with the latest version (7.7 - http://hapi.fhir.org/baseR4) as well.
POST the following Patient resource:
Now query it by a lot of identifiers with- and without system, some matching, some not:
GET http://hapi.fhir.org/baseR4/Patient?identifier=04139f3f-8966-48b5-ade6-0b81e31f4840,083cf97a-93e2-4cbd-86c9-704542ceb794,083fc777-e6e2-4863-8e55-996bdd651f41,0feda4fc-f56e-4841-9081-62de4ea7876e,330cd45d-3e5d-464d-a711-1662f5169725,331c8655-d21c-4495-9681-c2c563c45d19,3cf6ed52-267b-4a90-8f51-09e5a7ca2eeb,3f1e6406-ca82-4d7b-8bdc-33777d8bc322,573da5d0-4e0f-4b09-9a3a-27482217381f,76972015-2c87-4050-8f7d-c19bcd1d2a58,7b38f2d9-83a3-49ce-b0b2-19a0a5c5a10f,847b423d-9ece-4fa8-8151-4dfcd4a24ece,8a82844c-bc2c-4b18-8d0d-72f03a0eeee9,8f6ec33f-ebf4-4a7a-92ad-cf17c3db426e,91ebdeff-52cd-4ed7-88ff-0e2315eea03b,96d78622-852c-4de9-bcdb-b14cd2292d06,c7c60513-495e-42b0-9dd0-8ae2b7371086,d5c34548-9992-457c-8b7c-b771a686677a,e013cecc-e064-4b62-97fc-5499983d7ea8,e0a24aac-d534-4f61-b3ec-2f9678c1c60e,e0d3b9e5-8103-40ce-96f3-daeb50e1fa81,f17e3e12-8a46-4f0e-ba1d-5b19bb3873a3,fa973a54-8b71-4a40-b03f-9f8ec53a6cc5,feebbea1-4541-4026-8073-13635a8ef7de,urn%3Aoid%3A1.1.1.4.555%7C04139f3f-8966-48b5-ade6-0b81e31f4840,urn%3Aoid%3A1.1.1.4.555%7C083cf97a-93e2-4cbd-86c9-704542ceb794,urn%3Aoid%3A1.1.1.4.555%7C0feda4fc-f56e-4841-9081-62de4ea7876e,urn%3Aoid%3A1.1.1.4.555%7C330cd45d-3e5d-464d-a711-1662f5169725,urn%3Aoid%3A1.1.1.4.555%7C331c8655-d21c-4495-9681-c2c563c45d19,urn%3Aoid%3A1.1.1.4.555%7C3cf6ed52-267b-4a90-8f51-09e5a7ca2eeb,urn%3Aoid%3A1.1.1.4.555%7C3f1e6406-ca82-4d7b-8bdc-33777d8bc322,urn%3Aoid%3A1.1.1.4.555%7C573da5d0-4e0f-4b09-9a3a-27482217381f,urn%3Aoid%3A1.1.1.4.555%7C76972015-2c87-4050-8f7d-c19bcd1d2a58,urn%3Aoid%3A1.1.1.4.555%7C7b38f2d9-83a3-49ce-b0b2-19a0a5c5a10f,urn%3Aoid%3A1.1.1.4.555%7C847b423d-9ece-4fa8-8151-4dfcd4a24ece,urn%3Aoid%3A1.1.1.4.555%7C8a82844c-bc2c-4b18-8d0d-72f03a0eeee9,urn%3Aoid%3A1.1.1.4.555%7C8f6ec33f-ebf4-4a7a-92ad-cf17c3db426e,urn%3Aoid%3A1.1.1.4.555%7C91ebdeff-52cd-4ed7-88ff-0e2315eea03b,urn%3Aoid%3A1.1.1.4.555%7C96d78622-852c-4de9-bcdb-b14cd2292d06,urn%3Aoid%3A1.1.1.4.555%7Cc7c60513-495e-42b0-9dd0-8ae2b7371086,urn%3Aoid%3A1.1.1.4.555%7Cd5c34548-9992-457c-8b7c-b771a686677a,urn%3Aoid%3A1.1.1.4.555%7Ce013cecc-e064-4b62-97fc-5499983d7ea8,urn%3Aoid%3A1.1.1.4.555%7Ce0a24aac-d534-4f61-b3ec-2f9678c1c60e,urn%3Aoid%3A1.1.1.4.555%7Ce0d3b9e5-8103-40ce-96f3-daeb50e1fa81,urn%3Aoid%3A1.1.1.4.555%7Cf17e3e12-8a46-4f0e-ba1d-5b19bb3873a3,urn%3Aoid%3A1.1.1.4.555%7Cfa973a54-8b71-4a40-b03f-9f8ec53a6cc5,urn%3Aoid%3A1.1.1.4.555%7Cfeebbea1-4541-4026-8073-13635a8ef7de,urn%3Aoid%3A1.1.1%7C083fc777-e6e2-4863-8e55-996bdd651f41&_count=20
This results in a timeout.
Now remove the identifiers one by one and try to execute the query again.
The point is reached from timeout duration to ~500ms for the search.
The first one that worked for me was:
http://hapi.fhir.org/baseR4/Patient?identifier=04139f3f-8966-48b5-ade6-0b81e31f4840,083cf97a-93e2-4cbd-86c9-704542ceb794,083fc777-e6e2-4863-8e55-996bdd651f41,0feda4fc-f56e-4841-9081-62de4ea7876e,330cd45d-3e5d-464d-a711-1662f5169725,331c8655-d21c-4495-9681-c2c563c45d19,3cf6ed52-267b-4a90-8f51-09e5a7ca2eeb,3f1e6406-ca82-4d7b-8bdc-33777d8bc322,573da5d0-4e0f-4b09-9a3a-27482217381f,76972015-2c87-4050-8f7d-c19bcd1d2a58,7b38f2d9-83a3-49ce-b0b2-19a0a5c5a10f,847b423d-9ece-4fa8-8151-4dfcd4a24ece,8a82844c-bc2c-4b18-8d0d-72f03a0eeee9,8f6ec33f-ebf4-4a7a-92ad-cf17c3db426e,91ebdeff-52cd-4ed7-88ff-0e2315eea03b,96d78622-852c-4de9-bcdb-b14cd2292d06,c7c60513-495e-42b0-9dd0-8ae2b7371086,d5c34548-9992-457c-8b7c-b771a686677a,e013cecc-e064-4b62-97fc-5499983d7ea8,e0a24aac-d534-4f61-b3ec-2f9678c1c60e,e0d3b9e5-8103-40ce-96f3-daeb50e1fa81,f17e3e12-8a46-4f0e-ba1d-5b19bb3873a3,fa973a54-8b71-4a40-b03f-9f8ec53a6cc5&_count=20
Expected behavior
The search also works with many identifiers.
Environment (please complete the following information):
Additional context
According to the hibernate debug logs on local reproduction with 20 identifiers, there are three Search entititys (ca.uhn.fhir.jpa.entity.Search), for myVersion=1; myVersion=2; and myVersion=3.
If one more identifier is added to the search, 21 identifiers in total, there are 237 of these Search entities printed (myVersion=1; [...]; myVersion=237) before the following exception stops the seemingly endless loop:
ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HAPI-1163: Request timed out after 60070ms
at ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl.getResources(SearchCoordinatorSvcImpl.java:284)
at ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider.doSearchOrEverything(PersistedJpaBundleProvider.java:258)
at ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider.getResources(PersistedJpaBundleProvider.java:380)
at ca.uhn.fhir.jpa.search.PersistedJpaSearchFirstPageBundleProvider.getResources(PersistedJpaSearchFirstPageBundleProvider.java:109)
at ca.uhn.fhir.rest.server.method.ResponseBundleBuilder.pagingBuildResourceList(ResponseBundleBuilder.java:160)
at ca.uhn.fhir.rest.server.method.ResponseBundleBuilder.buildResponsePage(ResponseBundleBuilder.java:112)
at ca.uhn.fhir.rest.server.method.ResponseBundleBuilder.buildResponseBundle(ResponseBundleBuilder.java:57)
at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.doInvokeServer(BaseResourceReturningMethodBinding.java:201)
at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.invokeServer(BaseResourceReturningMethodBinding.java:275)
at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:1190)
at ca.uhn.fhir.rest.server.RestfulServer.doGet(RestfulServer.java:420)
at ca.uhn.fhir.rest.server.RestfulServer.service(RestfulServer.java:1923)
The text was updated successfully, but these errors were encountered: