-
-
Notifications
You must be signed in to change notification settings - Fork 511
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
Added error handling for context.Canceled in log reading code #2268
Merged
mdelapenya
merged 18 commits into
testcontainers:main
from
prateekdwivedi:context-canceled-logs
Mar 12, 2024
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4f058e3
Added error handling for context.Canceled in log reading code
prateekdwivedi e1e9eca
Added error handling for context.Canceled in log reading code
prateekdwivedi be7c25e
Added test case for context canceled error handling
prateekdwivedi 658bc2a
Added necessary import statement for log consumer test
prateekdwivedi 6a44042
Merge branch 'main' into context-canceled-logs
prateekdwivedi ded08d3
`make lint` changes
prateekdwivedi fa28f97
Merge branch 'main' into context-canceled-logs
prateekdwivedi 1ca31e1
Handled the termination of the containers
prateekdwivedi f6d2089
`make lint` changes
prateekdwivedi 2656a54
Merge branch 'main' into context-canceled-logs
mdelapenya 2e02ae7
Merge branch 'main' into context-canceled-logs
mdelapenya 45c1082
Merge branch 'main' into context-canceled-logs
prateekdwivedi 040c9e4
Cancelled log consumer test: Increased timeout
prateekdwivedi d18d71a
Merge branch 'main' into context-canceled-logs
prateekdwivedi fa2820d
Changes based on review comments
prateekdwivedi c953106
Merge branch 'main' into context-canceled-logs
prateekdwivedi beb3de6
Updated check for log messages in the Cancelled Context test
prateekdwivedi 59e3b3a
Merge branch 'main' into context-canceled-logs
prateekdwivedi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you want to trap the signals here ? Could it be enough to have a cancelleable context with
ctx, cancel := context.WithCancel(...)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JordanP :
Thank you for reviewing this PR. The reason for trapping the signal over there was to simulate an interrupt signal
Ctrl+C
, as that was the main motivation behind creating this PR. The objective was to prevent system hangs when multiple containers with log consumers receive an interrupt signal. As, with the latest version ( v0.28.0 ), the system hangs if someone pressesCtrl + C
to stop multiple containers with log consumers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Could it be enough to have a cancelleable context with ctx, cancel := context.WithCancel(...) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JordanP : Thanks for your suggestion. Yes, I tried using
context.WithCancel(...)
instead ofsignal.NotifyContext(...)
and it seems to have a similar effect in the test case. I have made the changes.