Bug: deploymentLogWriter.Close() does not wait for final flush to complete #4
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#4
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
In
internal/service/deploy/deploy.go,deploymentLogWriter.Close()closes thedonechannel to signal the flush goroutine to stop, but does not wait for the goroutine to finish. ThedoFlush()in the goroutine writes buffered log data to the database, but the caller may proceed (and mark the deployment as finished or write logs to file) before the final flush completes.Impact
Build log data may be lost. The last batch of log lines (up to 1 second worth) can be silently dropped.
Location
internal/service/deploy/deploy.go-deploymentLogWriter.Close()andrunFlushLoop()Fix
Add a
sync.WaitGroupor second channel to wait for the flush goroutine to complete its final flush before returning fromClose().