r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
331 stars 152 forks source link

`remotes::system_requirements`: ` Error: JSON: EXPECTED value GOT < ` #663

Closed bschilder closed 10 months ago

bschilder commented 2 years ago

Running:

remotes::system_requirements("ubuntu", "20.04")

produces the following error as of today:

 Error: JSON: EXPECTED value GOT < 

Expected output

Character vector of Ubuntu system requirements.

Recurring issue

494

324

Many thanks, Brian

bschilder commented 2 years ago

If this is not something that can easily be resolved, perhaps a more descriptive error message could be produced in the meantime?

jimhester commented 2 years ago

I can't reproduce this, and this error simply occurs when the endpoint returns HTML or XML instead of JSON, likely due to an error page. What package you were you trying to retrieve the system requirements for?

bschilder commented 2 years ago

I can't reproduce this, and this error simply occurs when the endpoint returns HTML or XML instead of JSON, likely due to an error page.

I think that's the crux of the issue, it happens seemingly at random.

Some things that might help:

  1. When the function encounters this error, have it rerun another N times to see if succeeds.
  2. Provide an error message indicating it was a problem with the endpoint (eg perhaps due to connection issues? issues with the server it's querying?) as opposed to the user misusing the function. This will help the user to narrow down the potential source of the error right away.

What package you were you trying to retrieve the system requirements for?

In this particular case, I'm using this function to install the necessary Linux deps to build and test my R packages (in this case orthogene). You can see an example here: https://github.com/neurogenomics/orthogene/runs/4049835231?check_suite_focus=true

You can see the full GH Actions workflow here: https://github.com/neurogenomics/orthogene/blob/93a674140c10bb15cdde20b5d4c42d75f91f0556/.github/workflows/check-bioc-docker.yml#L133

However, several hours ago, this error was also occurring when I ran the function by itself within my local Rstudio (MacOS), so it seems pretty independent of the pipeline.

cicdguy commented 2 years ago

I think this issue occurs due to public RSPM being unavailable at random times, as it is now.

image

cicdguy commented 2 years ago

The status page says RSPM is operational though... Must be a bug in the way statuses are monitored.

image

mpadge commented 2 years ago

This issue has also currently disabled rOpenSci's review bot, which is unable to check packages. Can reproduce by running call in a clean rocker/tidyverse container. A prompt fix would be very much appreciated :smile: :+1:

mpadge commented 2 years ago

Hmm, all seems okay again now. It is clearly intermittent as @dinakar29 suggested, but during times of failure it does seem entirely reproducible.

mpadge commented 2 years ago

The start of this failure arises because the rspm API delivers a "504 Bad Gateway". The following code is where the failure is triggered in our case, because it presumes the curl call to be failsafe: https://github.com/r-lib/remotes/blob/fcad17b68b7a19d5363d64adfb0a0426a3a5b3db/R/system_requirements.R#L71-L85

That suggests that fixing this issue just needs an error handler around that to generate a more informative error message for anything other than a 200 status before passing to json$parse.

cicdguy commented 2 years ago

Caught this in action, again: image

At least the status page reports the outage this time: image

Hopefully RStudio has any plans to improve stability/resiliency/HA for public-facing RSPM, as the demand for it grows over time.

gaborcsardi commented 2 years ago

We have plans both to improve the performance, and also to have better fallback, but both will take a couple of weeks unfortunately.

gaborcsardi commented 10 months ago

Hopefully this has been fixed now.