MEDIUM: deploymentLogWriter.Close() doesn't wait for flush goroutine — data loss #23
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#23
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?
Bug
File:
internal/service/deploy/deploy.go,deploymentLogWriterSeverity: MEDIUM — Data loss / race condition
Description
The
Close()method simply closes thedonechannel:But it doesn't wait for the
runFlushLoopgoroutine to complete its finaldoFlush(). This means:Close()may proceed to readdeployment.Logsbefore the final flush writes to the databasedoFlush()accessingw.deploymentand the caller potentially cleaning upSuggested Fix
Use a
sync.WaitGroupor a done-acknowledgment channel:fixed in #9