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

No error checking when running curl #29

Closed
danp opened this issue Jul 5, 2012 · 12 comments
Closed

No error checking when running curl #29

danp opened this issue Jul 5, 2012 · 12 comments

Comments

@danp
Copy link
Contributor

danp commented Jul 5, 2012

curl is shelled out to in various places, such as here, but it's not run with --fail and the run method doesn't do any error checking.

When a download done with curl silently fails it can lead to surprising errors such as can't convert nil into String (TypeError) from File.expand_path in add_bundler_to_load_path.

@hone
Copy link
Member

hone commented Jul 11, 2012

@dpiddy what should we do here? just use the --fail flag on curl, or just provide better error messaging?

@danp
Copy link
Contributor Author

danp commented Jul 11, 2012

I'd start with having run always check exit status and throw/display a general error (and internally log something) if what's being run fails. Then add --fail to all curl commands. Prefixing all commands run with run that use pipes with set -o pipefail; ... would be good too. Looks like pipe could also use an exit status check.

To get fancier with curl, I'd suggest something like:

$ curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 20 ...

This will get some retry on simple transient S3 issues.

@neersighted
Copy link

👍

@danp
Copy link
Contributor Author

danp commented Sep 28, 2012

Getting bit by this again today:

$ curl https://s3.amazonaws.com/heroku-buildpack-ruby/ruby_versions.yml
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InternalError</Code><Message>We encountered an internal error. Please try again.</Message><RequestId>F95682256711C6D9</RequestId><HostId>lipO+wYGTyZqVPUBv//x5inR6uM8ZQWnOQopnXAX0n92ngS1t76zxTSp24t9r2uE</HostId></Error>

Causing the weirdness I linked above as well as the indication that ruby-1.9.3 is not a valid RUBY_VERSION.

@schneems
Copy link
Contributor

schneems commented Nov 5, 2012

@dpiddy, would you be willing to work this into a PR. I don't see any reason to hide this information from users, and the retry code would be icing on the cake. Seems like a good idea.

@danp
Copy link
Contributor Author

danp commented Nov 10, 2012

Have a start of something here.

@hone
Copy link
Member

hone commented Jul 16, 2013

@dpiddy I was trying this out but ran into this issue: set: 1: Illegal option -o pipefail on heroku

@danp
Copy link
Contributor Author

danp commented Jul 16, 2013

Did you pick up the change to bash here? pipefail is a bash option.

@hone
Copy link
Member

hone commented Jul 16, 2013

Nope. Let me try that.

@schneems
Copy link
Contributor

It's been a few months, is your branch curl-usage-improvements in a PR-able state? Would like to either get this merged in or closed. I would think we also want to do most curls with --retry set to a non zero number.

@danp
Copy link
Contributor Author

danp commented Oct 4, 2013

Probably not. Maybe at this point I'd look into putting error checking and options (such as --retry) into Fetcher and ensuring it's used everywhere.

@schneems
Copy link
Contributor

@dpiddy can you look at #165 ?

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