Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Your request generated a server error, HTTP code 500 #7

Closed
pdi-uk opened this issue May 5, 2022 · 15 comments
Closed

Your request generated a server error, HTTP code 500 #7

pdi-uk opened this issue May 5, 2022 · 15 comments

Comments

@pdi-uk
Copy link

pdi-uk commented May 5, 2022

Time Out Error from HAPI FHIR Server (Request timed out after 60494ms) causes the script to terminate.

Is it possible to increase the number of trials of sending requests to the FHIR server?
Is it possible to decrease the size of the requests?

@palmjulia
Copy link
Contributor

I think @NandhiniS08 pushed an image of the docker container with reduced request sizes to https://hub.docker.com/r/nandhinis08/projectathon6-miracum1 because there was a similar problem in Leipzig (see MII slack), but we don't know yet if this helped..

Is there a chance you can try this image? If you want to build yourself maybe @NandhiniS08 can push the corresponding R code to a seperate branch for you to check out.

@pdi-uk
Copy link
Author

pdi-uk commented May 5, 2022

Yes. I would prefer to run the R code directly.

@palmjulia
Copy link
Contributor

Okay if you are comfortable with running R directly then maybe you'll be quicker applying the change yourself. In Line 352 youd have to change nchar_for_ids <- 1800 - (nchar(conf$serverbase)+nchar_loincs) to nchar_for_ids <- 900 - (nchar(conf$serverbase)+nchar_loincs).
This will reduce the number of Patients per request for which the LOINC coded Observations are downloaded (because the total request length is reduced and thus the Patients will be distributed over a higher number of requests, with fewer Patients per request). In Leipzig this change seemed to fix the timeout problem.

@mematt
Copy link
Contributor

mematt commented May 5, 2022

Thank you @palmjulia and @NandhiniS08 for the solutions.
We have just received the same HTTP 500 error from Wuerzburg.
It seems to come up quite frequently, thus I will add the quick fix to the readme right away.

@palmjulia
Copy link
Contributor

Yes I hope it is actually the same problem in all these places. In Jena (Smile Server) the original script ran flawlessly but the Smile is probably a bit stronger then the Hapi.

@pdi-uk
Copy link
Author

pdi-uk commented May 5, 2022

I remember trying the same fix with the last version.

@palmjulia
Copy link
Contributor

Probably similar, yes, because back then the loinc codes were not taken into account in the url length if I remember correctly. But now they already are and the computational load is still to high, or so it seems. So further (quite drastic) reduction might help...

@pdi-uk
Copy link
Author

pdi-uk commented May 5, 2022

I decreased to
nchar_for_ids <- 500 - (nchar(conf$serverbase)+nchar_loincs)
and still get the error.

@NandhiniS08
Copy link
Contributor

NandhiniS08 commented May 5, 2022

Decreasing to 500 will not help because of the fact that the length may go to a negative number
nchar_loincs = 616. Can you see if 900 works for you?

@pdi-uk
Copy link
Author

pdi-uk commented May 5, 2022

900 did not work either

@NandhiniS08
Copy link
Contributor

Oh Thats not good! May I ask if this error comes while execution of the observation request?

@pdi-uk
Copy link
Author

pdi-uk commented May 6, 2022

No, while executing the Condition request:

Starting download of ALL! bundles of resource type Condition from FHIR base URL http://as13-diz:18989/fhir.

This may take a while...
Fehler in check_response(response = response, log_errors = log_errors) :
Your request generated a server error, HTTP code 500. For more information see the generated error file.
Ruft auf: lapply -> FUN -> fhir_search -> get_bundle -> check_response
Ausführung angehalten

Are the ressources downloaded using a POST or GET request?
For the POLAR scripts there where similar problems using POST requests for the condition ressources, but not for encounter.

@pdi-uk
Copy link
Author

pdi-uk commented May 6, 2022

HAPI Version 5.3.0

@pdi-uk
Copy link
Author

pdi-uk commented May 6, 2022

In Postman the last next-link was resolving normally.

@pdi-uk
Copy link
Author

pdi-uk commented May 6, 2022

I tried to change
max_bundles = 100 -> max_bundles = 40
in line 131
now the script runs successfully.

@pdi-uk pdi-uk closed this as completed May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants