Skip to content

codeintel: Fix producer goroutine leak condition in `writeVisibleUploads`

Warren Gifford requested to merge ef/fix-deadlock into main

Created by: efritz

sanitizeCommitInput spawns a goroutine that writes values into one of three channels. writeVisibleUploads spawns three goroutines, one reading from each channel. If one of the consumers dies, it cancels the other consumers but the producer is still stuck trying to write to channels that are not being consumed.

This PR ensures that the producer exist when the enclosing function exists (which includes the error case of one consumer dying and canceling the others). No more leak!

Test plan

Unit and integration tests. See main-dry-run.

Merge request reports

Loading