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

setup-tinytex does not install tinytex without failling as a step in the workflow #213

Closed
cderv opened this issue Nov 23, 2020 · 16 comments
Closed
Labels
bug an unexpected problem or unintended behavior

Comments

@cderv
Copy link
Contributor

cderv commented Nov 23, 2020

On windows, I have a failing TinyTeX installation. However, the step shows as success on GHA.
It took me sometimes to understand that there was an error as I was confident the step was succeeded because the workflow has no stopped. I think the actions should clearly fail to prevent from misleading bug search.

Here an example of this :
https://github.com/rstudio/rmarkdown/pull/1958/checks?check_run_id=1443184428#step:6:33

It seems the actions is failing due to a timeout but that is another topic. This issue is only about a clear fail of the setup-tinytex action if nothing was installed.

@cderv cderv added the bug an unexpected problem or unintended behavior label Nov 23, 2020
@cderv
Copy link
Contributor Author

cderv commented Nov 23, 2020

Regarding error in the actions we get

  • problem of timeout that cause no zip to be download
Invoke-WebRequest : The operation has timed out.
  • Leads to an error in the script
(node:6072) UnhandledPromiseRejectionWarning: Error: The process 'D:\a\_temp\install-windows.bat' failed with exit code 1

but no error in the action

(node:6072) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6072) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@cderv
Copy link
Contributor Author

cderv commented Nov 23, 2020

It seems the actions is failing due to a timeout but that is another topic. This issue is only about a clear fail of the setup-tinytex action if nothing was installed.

As note, about this, it happens "sometimes" and not other. I believe there could be a timeout in the underlying infrastructure to download the TinyTeX bundle through yihui.org/tinytex/ that redirect to appveyor.

FYI @yihui

@yihui
Copy link

yihui commented Nov 24, 2020

I feel this will be hard to debug since it only happens "sometimes". The error "Invoke-WebRequest : The operation has timed out" seems to be from https://github.com/yihui/tinytex/blob/e1b43e503642bde86f00ec6428eb7f2e0faca566/tools/install-bin-windows.bat#L19 but I have no idea why it could time out. If the redirect to AppyVeyor is the culprit, setting the env var TINYTEX_VERSION (e.g., to 2020.11) will make it download from Github releases (but Github release assets are actually hosted on Amazon S3, so they'd also be redirected).

cderv added a commit to rstudio/tinytex that referenced this issue Feb 2, 2021
Installing TinyTeX on GHA using the BAT installed script for binaries has issue that this aims to resolve. 
`Invoke-Request` can have some issues with heavy binary and could be the cause of the unexpected error in GHA. We now use 3 download method, one after the other, starting with more recent .NET class to use in Powershell. The PR thread gives details about this.

The script also has now some exit code to clearly signal error that could be handled by other tools using this script. (should solve r-lib/actions#213)
@cderv
Copy link
Contributor Author

cderv commented Feb 2, 2021

We've made a change in the script install-bin-windows.bat so that:

  • it uses another download method that should be less problematic with TinyTeX binary size
  • fix the script so that exit code are returned for the action to correctly catch and throw an error. I believe this was the reason why the action did not stopped. Though I am not sure as there was an UnhandledPromiseRejectionWarning: coming from the action.

Anyway, what was done in the script should improve this installation, and hopefully stop the workflow if an error is happening during the installation.

@sckott
Copy link

sckott commented Feb 15, 2021

@cderv any way to use the fix you made in rstudio/tinytex@b2d1bae in GH Actions?

@cderv
Copy link
Contributor Author

cderv commented Feb 15, 2021

You should have nothing to do if you use r-lib/setup-tinytex@v1. The action will download the script from tinytex repo directly so it will contains the changes I made.

Do you still have issues ?

@sckott
Copy link

sckott commented Feb 15, 2021

yeah, still having problems. for example https://github.com/ropensci/parzer/runs/1906575841?check_suite_focus=true#step:5:1

@cderv
Copy link
Contributor Author

cderv commented Feb 15, 2021

Interesting. This is a new one.
But The improvement I mentioned above are for Windows only and your error is in Linux. So it won't help.
We had issues with windows only before.

This error is again hidden because the action does not finish by an error. So the Workflow does not error at tinytex installation step. That is too bad.

However the issue with the download is from tinytex script. It seems you got a 308 redirect instead of 301. It was working for me 4 hours acid. I'll have a look tomorrow into that.
Does it happen all the time since or some times as it was the case with windows?

There is some redirects happening and maybe this could cause troubles. One solution I explored was to directly download from the latest GitHub release. This is not yet use and still live hidden in my fork there: https://github.com/cderv/actions/tree/tinytex-bin/setup-tinytex-bin
In case it can help if you're stuck.

@sckott
Copy link

sckott commented Feb 15, 2021

I just noticed this on Linux in the past few hours, but could have started earlier. At least in that repo, the last build without an error on that step on Linux was 5 days ago

@cderv
Copy link
Contributor Author

cderv commented Feb 16, 2021

@sckott I think I got to the bottom of it. This is a combination of changes.

I'll open an issue in TinyTeX to add some tries maybe to see if we can use curl instead. Or just remove this 308 redirect thing to get directly the latest release. BTW it seems the redirect problem here is the consequence of an issue with yihui.org/tinytex/ - yihui/yihui.org#100

What you can do:

  • You can revert to a previous commit of this action that still install from source
    - uses: r-lib/actions/setup-tinytex@cf900fc6074207cb2793ab036f32e1e35c6d84cd
    - uses: r-lib/actions/setup-tinytex@v1
      env: 
        TINYTEX_VERSION: 2021.02

I would do the latter - this will install a fix bundle but you can easily update tlmgr and the package after if needed. You can control the bundle installed with TINYTEX_INSTALLER. See https://github.com/yihui/tinytex-releases

Regarding this issue in r-lib/actions, it seems the wget error did not throw a workflow step error. I'll see why.

Hope it helps. Thanks for the report.

@sckott
Copy link

sckott commented Feb 17, 2021

Thanks very much. I agree seems better to use the second option. And it worked! Thanks

@cderv
Copy link
Contributor Author

cderv commented Feb 17, 2021

@sckott this is now fixed on the TinyTeX side.

@sckott
Copy link

sckott commented Feb 18, 2021

awesome, thanks!

rubak added a commit to spatstat/spatstat that referenced this issue Feb 18, 2021
@rubak
Copy link

rubak commented Feb 18, 2021

I have been battling with this error as well. Thanks for providing a quick workaround solution. I also implemented option 2 above and it worked nicely, but afterwards I realized that due to the fix on the TinyTex side it was no longer necessary. Thanks anyway!

@gaborcsardi
Copy link
Member

As I understand this is now fixed.

@github-actions
Copy link

github-actions bot commented Nov 6, 2022

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

5 participants