ropensci / crul

R6 based http client for R (for developers)
https://docs.ropensci.org/crul
Other
107 stars 17 forks source link

rgbif users reporting that "HTTP/2 stream was not closed cleanly before end of the underlying stream" #174

Closed jhnwllr closed 1 year ago

jhnwllr commented 1 year ago

Multiple rgbif users have reported this error.

https://github.com/ropensci/rgbif/issues/579

Error in curl::curl_fetch_memory(x$url$url, handle = x$url$handle) : HTTP/2 stream was not closed cleanly before end of the underlying stream

I have never been able to reproduce the error on my side. I think it might be somewhat Mac OS related.

sckott commented 1 year ago

thanks @jhnwllr

I think it's likely a server issue - have you seen https://github.com/jeroen/curl/issues/232 ?

The user(s) could try to disable http2 from the client (R user) side with https://cran.r-project.org/web/packages/curl/vignettes/intro.html#Disabling_HTTP2 - with rgbif, since it uses crul, users can use crul::set_opts() https://docs.ropensci.org/crul/reference/crul-options.html e.g., like crul::set_opts(http_version = 2) and then try the code that's breaking again. (its very confusing but http_version = 2 means uses http v1.1)

sckott commented 1 year ago

Ah I can see you've already knew about what I mentioned above in rgibf issues.

Can you talk to folks managing the GBIF API and see if they can tweak anything in the GBIF API to fix this?

jhnwllr commented 1 year ago

ok thanks @sckott.

I ran a github actions test and was able to reproduce the error on Mac OS. https://github.com/ropensci/rgbif/blob/actions/tests/testthat/test-occ_search.r#L668 https://github.com/ropensci/rgbif/actions/runs/5321113219/jobs/9635790918#step:13:171

After setting curlopts=list(http_version=2) I didn't get the stream error anymore (there were other unrelated test fails). https://github.com/ropensci/rgbif/actions/runs/5322173421/jobs/9638248400#step:13:154

I think I will just suggest using. Maybe update the docs with this advice. crul::set_opts(http_version = 2)

sckott commented 1 year ago

Sounds good - i think you work at GBIF? Would you also be able to talk to the API devs and see if there's anything they can do?