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

Better error message when bitbucket rate limit is reached #81

Open
taw opened this issue Apr 28, 2016 · 4 comments
Open

Better error message when bitbucket rate limit is reached #81

taw opened this issue Apr 28, 2016 · 4 comments

Comments

@taw
Copy link

taw commented Apr 28, 2016

Currently phantomjs gem does this:

unless system "curl -L -O #{package_url}" or system "wget #{package_url}"
  ...

wget will return error code when it fails, so that makes sense, but curl won't - it will get 429 Rate Limit error, save html, and then try to "bunzip2" that, resulting in error message like:

bunzip2: phantomjs-2.1.1-linux-x86_64.tar.bz2 is not a bzip2 file.
tar: phantomjs-2.1.1-linux-x86_64.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

Passing -f to curl will "fix" that problem, and instead of failing with meaningless error message, it will raise

raise "\n\nFailed to load phantomjs! :(\nYou need to have cURL or wget installed on your system.\nIf you have, the source of phantomjs might be unavailable: #{package_url}\n\n"

which still leaves the problem of everybody's CIs failing transiently due to bitbucket rate limit error, but at least they'll fail with a meaningful error message.

Possible better "fix" for this would be to just retry loop 10 times with 1s in between or something like that, or try multiple sources (bitbucket→s3, github→s3 etc.), but this is a start.

@jamilbk
Copy link

jamilbk commented May 2, 2016

Hitting this now. The NPM version of this package allows an option to use a CDN to install phantomjs, maybe that would be useful here? Additionally, it would be nice to pass in an option to avoid re-downloading phantomjs if the tar file already exists. I can make these changes once I get a few spare minutes.

@sshaw
Copy link

sshaw commented Jun 3, 2016

I've opened #84 which will raise an exception if the archive cannot be extracted.

@taw what HTTP status code does Bitbucket return (I assume 429)? -f only works for 5XX errors:

-f, --fail
(HTTP) Fail silently (no output at all) on server errors...

@taw
Copy link
Author

taw commented Jun 18, 2016

@sshaw I don't remember. Someone needs to recheck that next time it's failing. I remember that my fix was working at that time ;-)

@shepmaster
Copy link

Likely duplicate of #70.

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

No branches or pull requests

4 participants