-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
net.Conn.Close() race condition can crash the runtime. #143
Labels
Comments
I should probably comment that yes... no one would ever write an ECHO server this way. But, for protocols like FastCGI, you need to be able to multiplex requests over a single socket, and any request might have a flag that says 'Close this when you are done', so the request handler needs to be able to Close() the socket outside of the goroutine that is Read()ing it. |
http://golang.org/cl/152130 Status changed to Started. |
This issue was closed by revision ef8f483. Status changed to Fixed. Merged into issue #-. |
I am still seeing this issue: $ hg log -l 1 changeset: 4186:2f32e74ab96e tag: tip user: Adam Langley <[email protected]> date: Sat Nov 21 15:53:03 2009 -0800 The following is a nonsensical demo of the crash: package main import( "io"; "time"; "fmt"; "net"; ) func proxy(dst, src net.Conn) { io.Copy(dst, src); } func main() { c1, err := net.Dial("tcp4", "", "www.google.com:80"); if err != nil { fmt.Printf("error1\n"); } c2, err := net.Dial("tcp4", "", "www.google.com:80"); if err != nil { fmt.Printf("error2\n"); } go proxy(c1, c2); go proxy(c2, c1); time.Sleep(2*1000*1000*1000); c1.Close(); c2.Close(); fmt.Printf("part 2\n"); c3, err := net.Dial("tcp4", "", "www.google.com:80"); if err != nil { fmt.Printf("error1\n"); } c4, err := net.Dial("tcp4", "", "www.google.com:80"); if err != nil { fmt.Printf("error2\n"); } go proxy(c3, c4); go proxy(c4, c3); time.Sleep(2*1000*1000*1000); c3.Close(); c4.Close(); } results in: part 2 pollServer AddFD 3 : epoll_ctl: no such file or directory panic PC=0x7f1677cdbfd8 net·*pollServer·AddFD+0x123 /home/eric/go/src/pkg/net/fd.go:138 net·*pollServer·AddFD(0x77ca8200, 0x7f16, 0x77d0f280, 0x7f16, 0x72, ...) net·*pollServer·Run+0x263 /home/eric/go/src/pkg/net/fd.go:260 net·*pollServer·Run(0x77ca8200, 0x7f16) goexit /home/eric/go/src/pkg/runtime/proc.c:135 goexit() 0x7f1677ca8200 unknown pc |
mwhudson
pushed a commit
to mwhudson/go
that referenced
this issue
May 22, 2015
Also alow more CMP variants. CMP $0, ZR eb1f03ff negs xzr, xzr CMP $5890452, ZR 1800019b ldr w27, 0x00000034 eb1b03ff negs xzr, x27 CMP ZR, ZR eb1f03ff negs xzr, xzr CMP R1, ZR eb0103ff negs xzr, x1 CMP ZR, R3 eb1f007f cmp x3, xzr CMP ZR, RSP eb3f63ff cmp sp, xzr CMP $0, RSP eb3f63ff cmp sp, xzr CMP $452, RSP f10713ff cmp sp, #0x1c4 CMP ZR, RSP eb3f63ff cmp sp, xzr CMP R1, RSP eb2163f cmp sp, x1 These are illegal: CMP RSP, ZR CMP RSP, R1 Fixes golang#142 Fixes golang#143
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by jesse.dailey:
Attachments:
The text was updated successfully, but these errors were encountered: