DataONEorg / rdataone

R package for reading and writing data at DataONE data repositories
http://doi.org/10.5063/F1M61H5X
36 stars 19 forks source link

Occasional 'SEC_E_BUFFER_TOO_SMALL' error when getObject(), getSystemMetadata() called #206

Open gothub opened 6 years ago

gothub commented 6 years ago

Occasionally when dataone::getObject() or getSystemetadata() are called, the following error is received:

Error in curl::curl_fetch_memory(url, handle = handle) : 
  schannel: next InitializeSecurityContext failed: SEC_E_BUFFER_TOO_SMALL (0x80090321) - The buffers supplied to a function was too small.
Called from: curl::curl_fetch_memory(url, handle = handle)

This may be an SSL issue. This has been seen it elsewhere, and attemps to fix it on the server side configuration have been made. For some background: when the R client tries to make a secure connection to the sever, there is a TLS handshake involved where the two systems negotiate the connection. On the server, we have a setting that asks the client to optionally provide an X509 certificate in the request (for cert-based auth rather than token-based auth). When this happens, there is this strange security rule about having to buffer the entire request while this negotiation happens. Request buffers tend to default to about 128K, so even a 1MB request could be problematic.

This may be related to https://www.r-bloggers.com/fixing-peer-certificate-cannot-be-authenticated/ and try to replicate the issue being made by the PI. If you get the error, try the set_config(config(ssl_verifypeer = 0L)) fix they mention. Let us know what happens.

Also, see https://stackoverflow.com/questions/31741762/r-error-installing-package-error-in-curlcurl-fetch-memoryurl-handle-ha#41696229