Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcp-mux: failed to send packet: io: read/write on closed pipe #503

Closed
m1k1o opened this issue Dec 7, 2022 · 0 comments · Fixed by #504
Closed

tcp-mux: failed to send packet: io: read/write on closed pipe #503

m1k1o opened this issue Dec 7, 2022 · 0 comments · Fixed by #504

Comments

@m1k1o
Copy link
Member

m1k1o commented Dec 7, 2022

When connecting to TCP MUX, having data flown though it and then disconnecting on the client side, I am flooded with failed to send packet: io: read/write on closed pipe until the server side is closed. It looks like, the close event is not propagated correctly.

When reverting this commit 7f13fd1 it works as expected. That means, connection was never closed before.

Checking if connection is actually open before writing to it seems to fix this issue. Adding following code to func (c *candidateBase) writeTo(raw []byte, dst Candidate) (int, error):

select {
case <-c.closedCh:
	return 0, io.ErrClosedPipe
default:
}

I suspect that this unconditional writing might lead to race condition that causes deadlock in very rare cases (5475fdb), and proactively closing the channel on server made this issue more visible. I am still investigating and trying to reproduce it.

Environment.

  • Version: v2.2.12
  • Browser: Chrome 107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant