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

panic: close of closed channel #4

Closed
rasky opened this issue Sep 28, 2015 · 3 comments
Closed

panic: close of closed channel #4

rasky opened this issue Sep 28, 2015 · 3 comments

Comments

@rasky
Copy link

rasky commented Sep 28, 2015

While using pgzip, I'm getting this error in some (not yet fully debugged) situations:

panic: close of closed channel

goroutine 2364 [running]:
github.com/klauspost/pgzip.(*Writer).checkError(0xc208060100, 0x0, 0x0)
/home/ubuntu/.go_workspace/src/github.com/klauspost/pgzip/gzip.go:254 +0xee
github.com/klauspost/pgzip.(*Writer).Write(0xc208060100, 0xc20827a000, 0x8000, 0x8000, 0x8000, 0x0, 0x0)
/home/ubuntu/.go_workspace/src/github.com/klauspost/pgzip/gzip.go:273 +0x6b
[...]

If it can help, the underlying writer for pgzip is a io.Pipe() writer, and the other end is copied into a socket, so it looks like the bug is related to the packetization of the data over the wire, since it's not fully reproducible.

From my reading of the code, it looks like the panic is actually a failure to propagate an underlying error code, so I will just put a print there to see what error code was triggered in the first place. Meanwhile, the traceback might be enough to point you to the bug causing the panic.

@rasky
Copy link
Author

rasky commented Sep 28, 2015

On second look, it looks like both pushError() and checkError() are closing the channel, which would explain the panic.

@klauspost
Copy link
Owner

Exactly. I just pushed a fix. I will do a test as well.

@klauspost
Copy link
Owner

Fixed with db54d9b and c21006e (test)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants