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

notify: Webhook endpoints can fail, but we must start the server. #4060

Merged
merged 1 commit into from
Apr 8, 2017

Conversation

harshavardhana
Copy link
Member

@harshavardhana harshavardhana commented Apr 7, 2017

Description

Ignore any network errors when registering a webhook
notifier during Minio startup sequence. This way server
can be started even if the webhook endpoint is not available
and unreachable.

Motivation and Context

Fixes #4050

How Has This Been Tested?

Manually with wrong config.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mention-bot
Copy link

@harshavardhana, thanks for your PR! By analyzing the history of the files in this pull request, we identified @donatello, @balamurugana and @krishnasrinivas to be potential reviewers.

@harshavardhana harshavardhana added this to the Edge cache milestone Apr 7, 2017
@harshavardhana harshavardhana force-pushed the do-not-fail branch 2 times, most recently from dc3009d to 70eb344 Compare April 7, 2017 03:00
@codecov-io
Copy link

codecov-io commented Apr 7, 2017

Codecov Report

Merging #4060 into master will decrease coverage by 0.06%.
The diff coverage is 54.32%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4060      +/-   ##
==========================================
- Coverage   67.71%   67.64%   -0.07%     
==========================================
  Files         175      175              
  Lines       24044    24106      +62     
==========================================
+ Hits        16281    16307      +26     
- Misses       6643     6674      +31     
- Partials     1120     1125       +5
Impacted Files Coverage Δ
cmd/utils.go 84.96% <ø> (-0.76%) ⬇️
cmd/event-notifier.go 72.56% <ø> (ø) ⬆️
cmd/notify-webhook.go 67.72% <54.32%> (-17.68%) ⬇️
cmd/fs-v1-background-append.go 78.52% <0%> (-1.35%) ⬇️
cmd/xl-v1-utils.go 92.18% <0%> (+0.82%) ⬆️
cmd/xl-v1-metadata.go 72.85% <0%> (+0.95%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60ea2b1...fd12f34. Read the comment docs.

@harshavardhana harshavardhana force-pushed the do-not-fail branch 2 times, most recently from d1ad709 to ae72ed0 Compare April 7, 2017 07:17

// Redo the request with the new redirect url if http 307
// is returned, quit the loop otherwise
if resp.StatusCode == http.StatusTemporaryRedirect {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a TODO here to check later if golang 1.8 follows 307 after POST ?
golang/go#7912

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is nothing do for since its already implemented in go1.8?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is nothing do for since its already implemented in go1.8?

Yes

// Set proper server user-agent.
req.Header.Set("User-Agent", globalServerUserAgent)

for {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like 'for' here is only needed to follow redirect urls, can you also add a comment here ?

}

// isNetErrorRetryable - is network error retryable.
func isNetErrorRetryable(err error) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is supposed to ignore error like 'connection refused' for example when remote port is closed, can you add more comments to understand ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connection refused is already *net.OpError ..

@harshavardhana harshavardhana force-pushed the do-not-fail branch 2 times, most recently from 5a19db4 to 58cfc4c Compare April 7, 2017 11:01
Ignore any network errors when registering a webhook
notifier during Minio startup sequence. This way server
can be started even if the webhook endpoint is not available
and unreachable.

Fixes minio#4050
@harshavardhana harshavardhana changed the title notify: Webhook endpoints can fail, but we start server. notify: Webhook endpoints can fail, but we must start server. Apr 8, 2017
@harshavardhana harshavardhana changed the title notify: Webhook endpoints can fail, but we must start server. notify: Webhook endpoints can fail, but we must start the server. Apr 8, 2017
@harshavardhana harshavardhana merged commit 6b4f368 into minio:master Apr 8, 2017
@harshavardhana harshavardhana deleted the do-not-fail branch April 8, 2017 08:13
harshavardhana added a commit to harshavardhana/minio that referenced this pull request May 4, 2017
This PR fixes a regression introduced in minio#4060
harshavardhana added a commit to harshavardhana/minio that referenced this pull request May 4, 2017
This PR fixes a regression introduced in minio#4060
harshavardhana added a commit to harshavardhana/minio that referenced this pull request May 4, 2017
This PR fixes a regression introduced in minio#4060
deekoder pushed a commit that referenced this pull request May 4, 2017
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

Successfully merging this pull request may close these issues.

Startup fails if webhook endpoint is offline.
5 participants