-
Notifications
You must be signed in to change notification settings - Fork 886
fix(agent): refactor trackScriptLogs
to avoid deadlock
#8084
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
Conversation
6c9c1ad
to
fe53927
Compare
trackScriptLogs
to avoid deadlocktrackScriptLogs
to avoid deadlock
fe53927
to
2798ecd
Compare
During agent close it was possible for the startup script logs consumer to enter a deadlock state where by agent close was waiting via `a.trackConnGoroutine` and the log reader for a flush event. This refactor removes the mutex in favor of channel communication and relies on two goroutines without shared state.
2798ecd
to
3913854
Compare
6f66e6e
to
78c478c
Compare
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.
@mafredri thoughts on moving this into agentsdk
? External packages like envbuilder and envbox use almost the exact same code, so it'd be good to keep it all race-free.
Sure, I can take a stab at it! 👍🏻 |
I'll merging this now and submit a separate PR which breaks this up into |
During agent close it was possible for the startup script logs consumer
to enter a deadlock state where by agent close was waiting via
a.trackConnGoroutine
and the log reader for a flush event.This refactor removes the mutex in favor of channel communication and
relies on two goroutines without shared state.
https://github.com/coder/coder/actions/runs/5313851600/jobs/9620310022?pr=8082
NOTE: Observe PR target is not
main
.