Skip to content

Panic due to double channel close in Streamer.Stream() #45

@onitake

Description

@onitake

In Streamer.Stream(), there is an inherent concurrency issue, because the Connection.Closed flag is used to determine if the Connection.Queue channel needs to be closed or not:

if !request.Connection.Closed {
close(request.Connection.Queue)
}

If someone closes the channel, the flag update is delayed, and a concurrent goroutine may try to close it again:

conn.Closed = true

As quick&dirty workaround, recover() can be used, but it would be better to remove this flag and find a different way to signal closure and trigger cleanup.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions