Skip to content

errors with TLS 1.3 for SChannel backend on Windows #308

Description

@mbjones

Some users report problems with curl on Windows recently failing to connect, with the following error:

> library(dataone)
> cn <- CNode("PROD")
Error in curl::curl_fetch_memory(url, handle = handle) : 
  Failure when receiving data from the peer [cn.dataone.org]:
schannel: failed to read data from server: SEC_E_CONTEXT_EXPIRED (0x80090317) - The context has expired and can no longer be used.

This seems to be associated with a recent change to the Schannel SSL backend on windows. Switching to using the OpenSSL backend (as described here: https://cran.r-project.org/web/packages/curl/vignettes/windows.html) seems to fix the problem but is probably not a great long-term solution. Here's a workaround by setting an environment variable to tell curl to use the OpenSSL backend:

write('CURL_SSL_BACKEND=openssl', file = "~/.Renviron", append = TRUE)

Restart the R session and verify that OpenSSL is now active (no longer in parenthesis):

> curl::curl_version()$ssl_version
Initiating curl with CURL_SSL_BACKEND: openssl
[1] "OpenSSL/3.5.0 (Schannel)"

Now, try the code again and it should work:

> library(dataone)
> cn <- CNode("PROD")

This doesn't identify why exactly this SSL error is occurring with SChannel, which would be good to solve, so leaving this ticket open. At a minimum we should document the workaround.

  • Document workaround
  • Fix problems with SChannel

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions