sassoftware / sassoftware/arke
Race in server.Consume between teardown and spawned goroutines
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6
- Forks
- 2
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 8
Description
server.Consume spawns sender and Subscribe goroutines that write to returnError and read stopForLoop through heap-escaped pointers, but Consume returns without waiting for them. The goroutines outlive Consume, racing against its writes to returnError and its deferred close+nil of stopForLoop.
Concretely:
- multiple writers can land on
returnError(the spawned goroutines plus the main path) with no synchronization; stopForLoopis closed and nil'd byConsume's defer while the goroutines may still be reading it.
Consume should wait for the spawned goroutines before returning, and stopForLoop should carry the error itself so the main path remains the sole writer of returnError.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the server.Consume entry point and trace the spawned sender and Subscribe goroutines, focusing on their access to returnError and stopForLoop. Run the relevant Go tests with the race detector; done means Consume waits for those goroutines, the main path is the sole returnError writer, and teardown no longer races with goroutine reads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, grpc
- Domain
- api, backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100