Improve goroutine management with tombs

Bug #1130479 reported by Casey Marshall
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hockeypuck
Invalid
Medium
Unassigned

Bug Description

PacketObject.Traverse is a convenient visitor-pattern like interface, but it leaks goroutines if the receiver returns early without reading all the objects from the channel. Other functions such as ReadKeys and ReadValidKeys have a similar problem.

We can "defer slurpUpTheRestOfTheChannel(someChan)" but it's a waste to have that goroutine continue working when we're just throwing away its messages until it closes the channel and exits.

Gustavo's tombs could be a potential solution. http://blog.labix.org/2011/10/09/death-of-goroutines-under-control

Revision history for this message
Casey Marshall (cmars) wrote :

Replaced this traversal with a visitor-style pattern that supports early exit.

Changed in hockeypuck:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.