digitalocean / go-libvirt

Package libvirt provides a pure Go interface for interacting with Libvirt. Apache 2.0 Licensed.
Apache License 2.0
928 stars 127 forks source link

Deadlock if Stream Shutdown races with Push #191

Open multippt opened 1 year ago

multippt commented 1 year ago

There's a deadlock scenario if the stream is being shutdown while still receiving events, which can occur if using LifecycleEvents and cancelling the context.

Example reproduction case

func TestStreamShutdown(t *testing.T) {
    s := NewStream(1, 2)
    events := testEvents(1)
    s.Shutdown()
    s.Push(events[0])
}