-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
There is a potential test of conditional scenarios where a sigsegv could happen.
- Replicator reads a batch of records. The walfs reader returns slices pointing directly to the memory-mapped file.
- Replicator sends this batch to the GrpcStreamer via a buffered channel.
- Replicator continues its loop, calls reader.Next(), and hits io.EOF.
- Replicator immediately calls reader.Close().
- This decrements the reference count on the underlying Segment.
If the segment was marked for deletion (e.g., it was rotated and is old), the reference count dropping to zero triggers Segment.cleanup(), which unmaps the memory.
Streamer (running in a separate goroutine) picks up the batch from the channel and tries to marshal the data for gRPC.
The simple fix would be copy the data from the mmap-ed slice into a new slice before adding it to the batch.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers