I have several programs written in R that use bigrquery to run queries, table deletes, and upload data. These were all written in R studio with R version 3.3.1 on a windows 7 machine. No issues at all running them over and over.
A new hire is trying to run the same exact programs on Windows 10. Same version of base R and R studio. The packages all install fine and there are no errors of any kind. But commands sent to bigquery through the code (i.e., query_exec, insert_upload_job) will submit, but they hang for several minutes, then return the following error:
Error in curl::curl_fetch_memory(url, handle = handle) : Stream error in the HTTP/2 framing layer
These queries run in 2 seconds normally. These commands run fast in base R on the same machine with no errors.
I have a Windows 10 laptop at home so I installed everything the same way, and it is displaying the same behavior. The commands run fine in base R but "hang" in R studio for several minutes before returning the error above.
What is weird is that periodically the same commands run fine in R studio, but most of the time we get the error.
I looked for this issue and found: r-hub/rhub#32
But I am not able to figure out how to turn off http2 on the client side to see if that would help.
One thing I noticed is that when I check the curl version with: curl::curl_version() It shows version 7.47.1 on my Windows 7 machine (the one that works) and does it does not show an http2 value.
On the Windows 10 machine, it shows curl version 7.53.1, and shows an http2=TRUE parameter.
I haven't been able to figure out how to deprecate the version of curl on the Win10 machine to see if that would fix the issue.
In any case, I would think if it's an issue with the latest version that other folks would be having the same issue.
I also posted this to the bigrquery github issues page but so far no one has responded.
Any help is appreciated!
There is no need to downgrade curl
to workaround the error in the HTTP2 framing layer. Instead, you could use one of the methods below to set a specific http_version
.
For those of you who use the httr
package, you can specify the preferred HTTP version directly like this:
# 0 stands for CURL_HTTP_VERSION_NONE (see http_version values below)
httr::set_config(httr::config(http_version = 0))
This workaround was suggested here.
Another (lower level) example of how to set the options directly using curl
is provided in the package vignettes here. An excerpt:
h <- curl::new_handle()
curl::handle_setopt(h, http_version = 0)
# then use the handle to make a request
# see curl vignettes for an example
For an RCurl
example, see TLS v1.1 / TLS v1.2 support in RCurl.
The curl HTTP version numbers are available in the C enum defined in the curl header file on GitHub (the link is to an older commit):
enum {
CURL_HTTP_VERSION_NONE, /* 0, setting this means we don't care, and that we'd
like the library to choose the best possible
for us! */
CURL_HTTP_VERSION_1_0, /* 1, please use HTTP 1.0 in the request */
CURL_HTTP_VERSION_1_1, /* 2, please use HTTP 1.1 in the request */
CURL_HTTP_VERSION_2_0, /* 3, please use HTTP 2 in the request */
CURL_HTTP_VERSION_2TLS, /* 4, use version 2 for HTTPS, version 1.1 for HTTP */
CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE, /* 5, please use HTTP 2 without HTTP/1.1
Upgrade */
CURL_HTTP_VERSION_LAST /* 6, *ILLEGAL* http version */
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With