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

fix: improve shut down logic #89

Merged
merged 5 commits into from
Jul 20, 2023

Conversation

maxmoehl
Copy link
Member

@maxmoehl maxmoehl commented Jul 19, 2023

See individual commits for details.

@maxmoehl maxmoehl changed the title fix: allow agent to shut down quickly fix: improve shut down logic Jul 19, 2023
@domdom82 domdom82 added the run-ci Triggers PR Validation label Jul 19, 2023
domdom82
domdom82 previously approved these changes Jul 19, 2023
Copy link
Contributor

@domdom82 domdom82 left a comment

Choose a reason for hiding this comment

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

approving for ci

@maxmoehl
Copy link
Member Author

In any case we will wait for #35 and I will rebase once that's in.

@peanball peanball marked this pull request as ready for review July 19, 2023 16:13
@peanball peanball requested a review from a team as a code owner July 19, 2023 16:13
peanball
peanball previously approved these changes Jul 19, 2023
b1tamara
b1tamara previously approved these changes Jul 19, 2023
maxmoehl and others added 4 commits July 19, 2023 18:49
To be able to notice that the context has been canceled we rely on at
least one more packet being read. In practice this should be fine but
especially during testing it can cause the agent to hang because no more
data is captured. This commit configures a timeout of one second for
reading a single packet. This ensures that we check at least once per
second if the capture has been stopped and allow the agent to stop
capturing even if no further packets are captured.

Co-Authored-By: Dominik Froehlich <dominik.froehlich@sap.com>
The API has the processing of messages received from the agent and the
sending of control messages to the agent in one function
`readMsgFromStream` which causes concurrency issues because we rely on
the blocking read call from becoming unblocked in order to tell the
agent to shut down. This, however, prevents the agent from ever shutting
down essentially making it impossible to stop a capture unless there is
a constant flow of packets.

This commit separates the upstream and downstream flows by creating two
separate routines when starting a capture on an agent. It also fixes
smaller issues like misleading names and sending to closed channels.
@domdom82 domdom82 merged commit f6d875d into cloudfoundry:main Jul 20, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-ci Triggers PR Validation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants