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

Add Timeout for EventListener Server #747

Merged
merged 1 commit into from
Nov 17, 2020

Conversation

khrm
Copy link
Contributor

@khrm khrm commented Sep 8, 2020

Added Timeout to avoid running out of file descriptor and leaking connections.

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

Add Read, Write, and Idle timeout for connections to the EventListener.

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 8, 2020
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 8, 2020
@khrm
Copy link
Contributor Author

khrm commented Sep 8, 2020

This pr might potentially resolve #687

@khrm khrm added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 8, 2020
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 8, 2020
@khrm khrm force-pushed the elServTimeout branch 2 times, most recently from 21c8471 to fe25c38 Compare September 8, 2020 14:57
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 8, 2020
@dibyom dibyom added this to the Triggers v0.9 milestone Sep 8, 2020
@khrm
Copy link
Contributor Author

khrm commented Sep 8, 2020

/retest

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 75.5% 76.7% 1.2

@khrm
Copy link
Contributor Author

khrm commented Sep 8, 2020

/test pull-tekton-triggers-integration-tests

1 similar comment
@khrm
Copy link
Contributor Author

khrm commented Sep 8, 2020

/test pull-tekton-triggers-integration-tests

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 75.5% 76.7% 1.2

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 75.5% 76.7% 1.2


srv := &http.Server{
Addr: fmt.Sprintf(":%s", sinkArgs.Port),
ReadTimeout: sinkArgs.ELReadTimeOut * time.Second,
Copy link
Member

Choose a reason for hiding this comment

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

ReadTimeout includes reading both headers + body. Maybe we should use ReadHeaderTimeout instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or may we set both? What would be the sane values for all these?

Copy link
Member

Choose a reason for hiding this comment

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

5 seconds sounds reasonable to me.

cmd/eventlistenersink/main.go Show resolved Hide resolved
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 75.5% 76.7% 1.2

@dibyom
Copy link
Member

dibyom commented Sep 10, 2020

@khrm How do you feel about adding just a IdleTimeout for the v0.8.1 release. We can then add the additional timeouts + config options to change it for v0.9?

I opened #755 with just that subset of changes. Let me know what you think!

@khrm
Copy link
Contributor Author

khrm commented Sep 11, 2020

@dibyom Yea, that's good.

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 12, 2020
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 76.2% 77.4% 1.2

@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 17, 2020
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 76.2% 77.4% 1.2

@khrm khrm changed the title WIP: Add Timeout for EventListener Server Add Timeout for EventListener Server Sep 21, 2020
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 21, 2020
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 76.2% 77.4% 1.2

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 76.2% 77.4% 1.2

WriteTimeout: sinkArgs.ELWriteTimeOut * time.Second,
IdleTimeout: sinkArgs.ELIdleTimeOut * time.Second,
Handler: http.TimeoutHandler(mux,
sinkArgs.ELTimeOutHandler*time.Second, "EventListener Timeout!\n"),
Copy link
Member

Choose a reason for hiding this comment

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

is there a way to add some extra info here e.g. the eventID or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, unless we write our own custom thing.

@dibyom
Copy link
Member

dibyom commented Oct 6, 2020

Summarizing discussion from last week's WG:

  • There are a lot of controls, which give users a lot of power...but we'd need docs to explain how these timeouts work with each other and when to use what.

  • As an alternative, maybe we can have a single timeout for the entire request processing time that the user can control (e.g. 30s) ? We'd use a context and cancel the context after this deadline. That might make this easier to explain/use.

  • At any rate, we should keep the IdleTimeout at least so that we are not leaking connections.

@dibyom dibyom modified the milestones: Triggers v0.9, Triggers v0.10 Oct 6, 2020
@dibyom dibyom linked an issue Nov 16, 2020 that may be closed by this pull request
Added Timeout to avoid running out of file descriptor and leaking connections. These timeouts are configurable via config.
@khrm
Copy link
Contributor Author

khrm commented Nov 17, 2020

@dibyom @wlynch Can we merge this pr? I have added relevant doc in eventlistener.md

@dibyom
Copy link
Member

dibyom commented Nov 17, 2020

/approve
/lgtm

(We should still consider adding a context based timeout to cancel trigger processing that takes more than x seconds)

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 17, 2020
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 17, 2020
@tekton-robot tekton-robot merged commit 6657c79 into tektoncd:master Nov 17, 2020
@khrm khrm deleted the elServTimeout branch July 28, 2021 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EventListeners stops receiving events randomly
3 participants