Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
colexec: create new message to send metadata in unordered synchronizer
This commit fixes a race condition where a metadata message would be double-freed and therefore the same object returned to two different goroutines from a sync.Pool. The root cause of this issue was that input goroutines in the parallel unordered synchronizer use a single message that is sent repeatedly over a channel instead of multiple messages to avoid allocations. A scenario could occur where an input would drain metadata and set its message's metadata field while its message was still unread in the channel. The message would then be sent on the channel again, and the synchronizer's DrainMeta method would read the first message with the metadata field set, followed by the same message a second time. This results in returning the same metadata message twice to the distsql receiver, which would release the same metadata twice. The solution is to instead allocate a new message when draining, which will leave message already present in the channel untouched. Release note: None (no release with bug)
- Loading branch information