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

TinyTex download timeout limit #286

Closed
matthewgson opened this issue Mar 9, 2021 · 3 comments
Closed

TinyTex download timeout limit #286

matthewgson opened this issue Mar 9, 2021 · 3 comments
Labels

Comments

@matthewgson
Copy link

matthewgson commented Mar 9, 2021

Hi, I'm wondering if the timeout limit was necessary when downloading TinyTex from R session. In my sample, it fails 2 times and take 83 seconds in third time to download the package. Could you consider increasing default timeout limit (say, 3 minutes?), or change its behavior to start right from the third approach?

trying URL 'https://yihui.org/tinytex/TinyTeX-1.tgz'
Content type 'application/octet-stream' length 68518405 bytes (65.3 MB)
==============================================
downloaded 60.5 MB

trying URL 'https://yihui.org/tinytex/TinyTeX-1.tgz'
Content type 'application/octet-stream' length 68518405 bytes (65.3 MB)
===============
downloaded 20.4 MB

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   117    0   117    0     0    304      0 --:--:-- --:--:-- --:--:--   304
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 65.3M  100 65.3M    0     0   801k      0  0:01:23  0:01:23 --:--:--  944k
Warning messages:
1: In download.file(url, output, ..., method = method) :
  downloaded length 63422464 != reported length 68518405
2: In download.file(url, output, ..., method = method) :
  URL 'https://appveyorcidatav2.blob.core.windows.net/yihui-27038/tinytex/1-0-1447/nalg642ybsit7moh/TinyTeX-1.tgz?sv=2015-12-11&sr=c&sig=vA6JhS%2Bx3cv9YssXgpz0HRYx6l2avhU9BFx9vtQQok4%3D&st=2021-03-09T14%3A45%3A17Z&se=2021-03-09T14%3A51%3A17Z&sp=r': Timeout of 60 seconds was reached
3: In download.file(url, output, ..., method = method) :
  downloaded length 21397504 != reported length 68518405
4: In download.file(url, output, ..., method = method) :
  URL 'https://appveyorcidatav2.blob.core.windows.net/yihui-27038/tinytex/1-0-1447/nalg642ybsit7moh/TinyTeX-1.tgz?sv=2015-12-11&sr=c&sig=JWP%2By8dj3RZWIcRdXkQkMvwYeB%2FaAsXA5aKC%2F2o0a6g%3D&st=2021-03-09T14%3A46%3A17Z&se=2021-03-09T14%3A52%3A17Z&sp=r': Timeout of 60 seconds was reached

SessionInfo

R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.2.3

By filing an issue to this repo, I promise that

  • [v] I have fully read the issue guide at https://yihui.org/issue/.
  • [v] I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('tinytex'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/tinytex').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • [v] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@cderv
Copy link
Contributor

cderv commented Mar 9, 2021

What is the command you run in the first place ? install_tinytex() ?
If so I think the different tries are different download methods but I am not sure we set a timeout. Know that download.file() has one by default of 60 seconds. See ?download.file()

The timeout for many parts of the transfer can be set by the option timeout which defaults to 60 seconds. This is often insufficient for downloads of large files (50MB or more) and so should be increased when download.file is used in packages to do so. Note that the user can set the default timeout by the environment variable R_DEFAULT_INTERNET_TIMEOUT in recent versions of R, so to ensure that this is not decreased packages should use something like

options(timeout = max(300, getOption("timeout")))

You could try that on your R session.

@yihui
Copy link
Member

yihui commented Mar 9, 2021

@matthewgson I just increased the default timeout value to 3600 seconds in xfun::download_file(). You can either install the development version of xfun:

remotes::install_github('yihui/xfun')

or set options(timeout) as suggested by @cderv above. Thanks!

@cderv
Copy link
Contributor

cderv commented Mar 9, 2021

So quick ! I was also looking at adding it in xfun to increase the option. 😅 👍

clrpackages pushed a commit to clearlinux-pkgs/R-xfun that referenced this issue Mar 16, 2021
Yihui Xie (22):
      use exit_call(), and return early if stringsAsFactors is already false
      clarify the title, since not all functions are written by me
      vectorize relative_path(): rstudio/bookdown#1091
      use tinytex::is_tinytex() since v0.30 is on CRAN now
      update license year
      don't override the env var R_LIBS_USER if it has been set
      read both ~/.Renviron and .Renviron
      factor out path_sep()
      if no package is left after ignoring specified packages, return early
      when rechecking packages, make sure their dependencies are installed
      add a function to help clean up a dir that contains binary packages built with an older major version of R
      always return the names of broken packages
      add functions to query Homebrew dependencies of R packages
      add a function `retry()` to retry calling a function for a number of times in case of errors
      also split package names by spaces, e.g., "pandoc pandoc-citeproc" -> c("pandoc", "pandoc-citeproc")
      use tools::write_PACKAGES() instead of write.dcf() (to also update PACKAGES.gz/.rds)
      fix rstudio/tinytex#286: increase the timeout to 3600 seconds in download_file()
      add a function sort_file() to sort text lines in a file
      the argument `FUN` was renamed to `fun` in `process_file()`; this is for consistency with other functions like retry() and exit_call(), but might be a breaking change (if that's the case, I may revert this change)
      factor out the code to read sysreqsdb.rds
      use known dependencies instead of querying every time
      CRAN release v0.22

christophe dervieux (1):
      typo in on.exit() help page
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jun 1, 2021
# CHANGES IN xfun VERSION 0.23

## NEW FEATURES

- Added a `tinify()` function to compress PNG/JPEG images via [the Tinify API](https://tinypng.com/developers).

- Added a `news2md()` function to convert package news to the Markdown format. This is mainly for converting the plain-text `NEWS` file and the `NEWS.Rd` file to `NEWS.md`.

- Added a `format_bytes()` function to format numbers of bytes using a specified unit, e.g., `1024` can be formatted as `1 Kb`.

- When using `pkg_load2()` in an **renv** project, it will use `renv::install()` to install missing packages by default to take advantage of **renv**'s caching feature (thanks, @chunyunma @cderv, #52).

- `upload_win_builder()` no longer requires the system command `curl` to be available; if `curl` is not available, the R package **curl** will be used instead, which means this R package must be installed. In addition to uploading to the `ftp` server of win-builder, it's also possible to upload to <https://win-builder.r-project.org/upload.aspx>: call `upload_win_builder(..., server = 'https')`. This change was made so that it would be possible to continue to upload to win-builder in case it should stop supporting `ftp` (CRAN has discouraged package authors from using `ftp://`).

## BUG FIXES

- Backticks are added to math environments by mistake when `\begin{}` and `\end{}` do not match (thanks, @oliviergimenez, #51).

## MINOR CHANGES

- The argument `src` was renamed to `pkg` in `install_dir()`.

- The argument `file` of `upload_win_builder()` defaults to `pkg_build()` now, i.e., by default, it will build a source package and upload it, so you do not need to build the package separately.

# CHANGES IN xfun VERSION 0.22

## NEW FEATURES

- `relative_path()` is vectorized now.

- Added a new function `retry()` to retry calling a function for a number of times in case of errors.

- Added a new function `sort_file()`, which is a shorthand for `process_file(fun = sort)` to sort the lines in a text file.

## MAJOR CHANGES

- The argument `FUN` was renamed to `fun` in `process_file()`.

## MINOR CHANGES

- Inside `download_file()`, the `timeout` option in `options()` is set to 3600 seconds when it takes the default value of 60 seconds, which may not be enough for downloading large files (thanks, @matthewgson, rstudio/tinytex#286).

# CHANGES IN xfun VERSION 0.21

## NEW FEATURES

- Added a new function `pkg_available()` to test if a package with a minimal version is available (thanks, @cderv, #45).

- Added a new function `set_envvar()` to set environment variables and return their old values, so they could be restored later.

- Added a new function `exit_call()` to call a function when a parent function exits.

- Exported the internal function `read_bin()`.

- Added an argument `verbose` to `bg_process()`.

- `Rscript_call()` gains an `options` argument to pass command-line options to `Rscript` (thanks, @cderv, #48).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants