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

build_news curl error schannel: next InitializeSecurityContext failed #2211

Closed
mabesa opened this issue Oct 14, 2022 · 18 comments · Fixed by hydrosolutions/riversCentralAsia#107
Milestone

Comments

@mabesa
Copy link

mabesa commented Oct 14, 2022

Hello,

I'm getting the following an error from curl for a site to the package available here: https://github.com/hydrosolutions/riversCentralAsia/ that seems (to me) to point to a connection error (error message below). It might all be a curl problem but as the news page does not seem to be quite properly deployed on the package site: https://hydrosolutions.github.io/riversCentralAsia/news/index.html I thought I might dare to bother you here.

I would greatly appreciate any help.
Below are error message, version infos, and what I tried.

pkgdown::build_news()
-- Building news ----------------------------------------------------------------------------------
Error in curl::curl_fetch_memory(url, handle = handle) :
schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).

I'm working with R version 4.2.1 in RStudio 2022.07.1 Build 554, pkgdown is version 2.0.6

curl::curl_version()
$version
[1] "7.64.1"

$ssl_version
[1] "(OpenSSL/1.1.1k) Schannel"

$libz_version
[1] "1.2.12"

$libssh_version
[1] "libssh2/1.9.0"

$libidn_version
[1] NA

$host
[1] "x86_64-w64-mingw32"

$protocols
[1] "dict" "file" "ftp" "ftps" "gopher" "http" "https" "imap" "imaps" "ldap"
[11] "ldaps" "pop3" "pop3s" "rtsp" "scp" "sftp" "smtp" "smtps" "telnet" "tftp"

$ipv6
[1] TRUE

$http2
[1] FALSE

$idn
[1] TRUE

I tried to test curl_fetch_memory following this thread jeroen/curl#261
Here is the output:

library(curl)
Using libcurl 7.64.1 with Schannel
h <- new_handle(verbose=TRUE)
req <- curl::curl_fetch_memory("https://miktex.org/", handle = h)

GET / HTTP/1.1
Host: miktex.org
User-Agent: RStudio Desktop (2022.7.1.554); R (4.2.1 x86_64-w64-mingw32 x86_64 mingw32)
Accept: /
Accept-Encoding: deflate, gzip

  • schannel: failed to decrypt data, need more data
  • schannel: failed to decrypt data, need more data
  • schannel: failed to decrypt data, need more data
  • schannel: failed to decrypt data, need more data
    < HTTP/1.1 200 OK
    < Content-Type: text/html; charset=utf-8
    < Server: Microsoft-IIS/10.0
    < Strict-Transport-Security: max-age=2592000
    < Date: Fri, 14 Oct 2022 15:01:40 GMT
    < Content-Length: 21113
    <
  • schannel: failed to decrypt data, need more data
  • schannel: failed to decrypt data, need more data
  • Connection Incorrect output with attr id #3 to host miktex.org left intact

This is where it becomes a tick too geeky for me to follow up on.

@maelle
Copy link
Collaborator

maelle commented Oct 14, 2022

I've cloned your repository and do not get the error but I also see the changelog is empty in the resulting pkgdown website.

The headers in https://github.com/hydrosolutions/riversCentralAsia/blob/master/NEWS.md?plain=1 are not in the format expected by pkgdown, see https://pkgdown.r-lib.org/reference/build_news.html I've made a PR hydrosolutions/riversCentralAsia#107

I'd also recommend not building the website locally yourself: instead you could rely on GitHub Actions. If you

then at each commit to the default branch, the website will be automatically built and deployed to the gh-pages branch. You might need to change the GitHub Pages settings of your repository.

Then if you get a bug again, you can post a link to the log of the GitHub Actions run. 😸

@maelle
Copy link
Collaborator

maelle commented Oct 14, 2022

(noting this does not solve the curl problem you saw 🤔 😅 )

@mabesa
Copy link
Author

mabesa commented Oct 14, 2022

Wow, fantastically quick!

Thank you for noticing the formatting problem in NEWS.md I merged your fix. I also deleted docs and commited after use_github_action. It takes several minutest to set up the dependencies and after adding tidyverse to the Dependencies the pkgdown workflow runs through without error. However, there is still an older workflow pages-build-deployment which errrors because it doesn't find docs. I need to ask my colleague to remove that workflow. Hopefully this will solve the problem!

Thanks a lot for your tips!!

@maelle
Copy link
Collaborator

maelle commented Oct 14, 2022

It was lucky timing. You're welcome! 😸

To fix the GitHub pages deployment you need to change the source of the GitHub Pages website from the docs folder to the gh-pages branch see https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-from-a-branch

After you do that and when it works you can add the URL of the deployed pkgdown website to DESCRIPTION, _pkgdown.yml and the repository description. Good luck!

@mrustl
Copy link

mrustl commented Oct 17, 2022

Hi @maelle, have a similar issue for one of my R packages kwb.geosalz, where I have a cron job for pkgdown (which worked fine until 2022-10-14) also crashed today during rendering of NEWS.md.

Here the GH actions log for windows-latest (https://github.com/KWB-R/kwb.geosalz/actions/runs/3263114575/jobs/5362680759#step:11:285)

-- Building news ---------------------------------------------------------------

Error in curl::curl_fetch_memory(url, handle = handle) : 

  schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).

Error: 
! error in callr subprocess
Caused by error in `curl::curl_fetch_memory(url, handle = handle)`:
! schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).
---
Backtrace:
1. kwb.pkgbuild::deploy_to_branch_with_extra_files(vignettes_file_pattern_to_…
2. pkgdown::build_site(pkg, devel = FALSE, preview = FALSE, install = FALSE, …
3. pkgdown:::build_site_external(pkg = pkg, examples = examples, run_dont_run = run_don…
4. callr::r(function(..., cli_colors, pkgdown_internet) { …
5. callr:::get_result(output = out, options)
6. callr:::throw(callr_remote_error(remerr))
7. callr:::callr_remote_error(remerr)
8. callr:::throw(err, parent = remerr[[3]])
---
Subprocess backtrace:
1. pkgdown::build_site(...)
2. pkgdown:::build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_r…
3. pkgdown::build_news(pkg, override = override, preview = FALSE)
4. pkgdown:::build_news_single(pkg)
5. pkgdown:::data_news(pkg)
6. pkgdown:::pkg_timeline(pkg$package)
7. httr::RETRY("GET", url, quiet = TRUE)
8. base::stop(resp)
9. global (function (e) …
── Removing worktree ───────────────────────────────────────────────────────────
Running git worktree remove \
  "C:/Users/RUNNER~1/AppData/Local/Temp/Rtmpcn7Rjz/file176c38c26aaa"
Execution halted

@maelle
Copy link
Collaborator

maelle commented Oct 17, 2022

@gaborcsardi (happy to report this possible bug elsewhere!) pkgdown calls crandb.r-pkg.org

pkgdown/R/build-news.R

Lines 259 to 280 in 7fe9e80

pkg_timeline <- function(package) {
if (!has_internet()) {
return(NULL)
}
url <- paste0("https://crandb.r-pkg.org/", package, "/all")
resp <- httr::RETRY("GET", url, quiet = TRUE)
if (httr::http_error(resp)) {
return(NULL)
}
content <- httr::content(resp)
timeline <- content$timeline
data.frame(
version = names(timeline),
date = as.Date(unlist(timeline)),
stringsAsFactors = FALSE,
row.names = NULL
)
}

There have been two reports of errors (like in the comment right before this one). Could this be due to something intermittently wrong with the API?

@maelle maelle reopened this Oct 17, 2022
@mrustl
Copy link

mrustl commented Oct 17, 2022

Could it be related to the new version of curl (4.3.3) by @jeroen (on CRAN since 2022-10-06) due to the curl::curl_fetch_memory() error?

@gaborcsardi
Copy link
Member

gaborcsardi commented Oct 17, 2022

There have been two reports of errors (like in the comment right before this one). Could this be due to something intermittently wrong with the API?

Which comment? The original message shows that miktex.org fails as well, so it is more like to be something in Windows or the curl binary.

@mabesa does it work with base R?

download.file("https://miktex.org", tmp <- tempfile())

EDIT: Actually, miktex.org seems to be OK, that message is not an error. Never mind then.

@maelle
Copy link
Collaborator

maelle commented Oct 17, 2022

the error was


Error in curl::curl_fetch_memory(url, handle = handle) : 

  schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).

Error: 
! error in callr subprocess
Caused by error in `curl::curl_fetch_memory(url, handle = handle)`:
! schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).
---
Backtrace:
1. kwb.pkgbuild::deploy_to_branch_with_extra_files(vignettes_file_pattern_to_…
2. pkgdown::build_site(pkg, devel = FALSE, preview = FALSE, install = FALSE, …
3. pkgdown:::build_site_external(pkg = pkg, examples = examples, run_dont_run = run_don…
4. callr::r(function(..., cli_colors, pkgdown_internet) { …
5. callr:::get_result(output = out, options)
6. callr:::throw(callr_remote_error(remerr))
7. callr:::callr_remote_error(remerr)
8. callr:::throw(err, parent = remerr[[3]])

Locally I didn't get it.

@maelle
Copy link
Collaborator

maelle commented Oct 17, 2022

@mrustl by the way why build the pkgdown website on Windows on GitHub Actions?

@mrustl
Copy link

mrustl commented Oct 17, 2022

@gaborcsardi
Copy link
Member

A workaround that probably works is to set the CURL_SSL_BACKEND="openssl" env var, before starting R.

mrustl added a commit to KWB-R/kwb.geosalz that referenced this issue Oct 17, 2022
r-lib/pkgdown#2211 (comment)).

Worked already locally on in my Win10 Pro OS
@maelle maelle modified the milestones: 2.1.0, 2.0.7 Oct 20, 2022
mrustl added a commit to KWB-R/kwb.pkgbuild that referenced this issue Oct 24, 2022
@dbosak01
Copy link

I've also been getting this error for a couple weeks. I was getting it on multiple packages, and multiple versions of pkgdown. Finally I found a workaround by turning off the news release dates in the _pkdown.yml, like this:

news:
cran_dates: false

Now it is fixed on all my packages. I'm mentioning this to help anyone with the same error, but also give a clue regarding diagnosis/resolution. Ultimately, I'd like to get the release dates on my news files back.

@gaborcsardi
Copy link
Member

@dbosak01 Are you on Windows? Does the workaround suggested above work for you?

@gaborcsardi
Copy link
Member

This should be fixed now.

@dbosak01
Copy link

@gaborcsardi Confirmed! Thanks much!

@maelle
Copy link
Collaborator

maelle commented Oct 27, 2022

Thanks @gaborcsardi!

@maelle
Copy link
Collaborator

maelle commented Oct 27, 2022

(and thanks @jeroen 😸)

ebuhle added a commit to ebuhle/salmonIPM that referenced this issue Aug 13, 2024
usethis::use_pkgdown() apparently successful, but pkgdown::build_site() fails with
Error:
! in callr subprocess.
Caused by error in `inDL(x, as.logical(local), as.logical(now), ...)`:
! unable to load shared object 'C:/R/R-4.3.2/library/httpuv/libs/x64/httpuv.dll':
  LoadLibrary failure:  The specified procedure could not be found.

Then usethis::use_pkgdown_github_pages() apparently successful. Following r-lib/pkgdown#2211 (comment), delete /docs and try pushing to initiate GHA.
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

Successfully merging a pull request may close this issue.

5 participants