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

net: Dial in init function hangs for 2 minutes #5216

Closed
rogpeppe opened this issue Apr 5, 2013 · 8 comments
Closed

net: Dial in init function hangs for 2 minutes #5216

rogpeppe opened this issue Apr 5, 2013 · 8 comments
Milestone

Comments

@rogpeppe
Copy link
Contributor

rogpeppe commented Apr 5, 2013

There's a server listening on localhost:14356.
The following code sometimes blocks for exactly 3
minutes when GOMAXPROCS>1. (I verified that other code can connect
during this time).

go version e77430da3316, ubuntu 12.10, amd64

package main
import (
    "fmt"
    "net"
)
func init() {
    fmt.Printf("dialling\n")
    _, err := net.Dial("tcp", "localhost:14356")
    fmt.Printf("err %v\n", err)
}

func main() {
    fmt.Printf("here\n")
}
@rogpeppe
Copy link
Contributor Author

rogpeppe commented Apr 5, 2013

Comment 1:

Sorry, a mistake in the above: it hangs for exactly *2* minutes.

@mikioh
Copy link
Contributor

mikioh commented Apr 5, 2013

Comment 2:

Labels changed: added go1.1.

@mikioh
Copy link
Contributor

mikioh commented Apr 5, 2013

Comment 3:

Labels changed: added priority-soon, removed priority-triage.

Status changed to Accepted.

@ality
Copy link
Member

ality commented Apr 5, 2013

Comment 4:

The scavenger thread forces a gc (and hence an stop/start the world cycle) every two
minutes.
Please
  - run it with GOGCTRACE=1 and wait for it to finish
  - then run it and press Ctrl-\ while it's hung to get a traceback
then post the results.
Thanks.

@davecheney
Copy link
Contributor

Comment 5:

I have confirmed this on OS X (just in case it was a epoll/kqueue related issue)
odessa(~/src) % time GOMAXPROCS=4 GOGCTRACE=1 ./rog 
gc1(1): 0+0+0 ms, 0 -> 0 MB 35 -> 37 (38-1) objects, 0(0) handoff, 0(0) steal, 0/0/0
yields
dialling
scvg0: inuse: 0, idle: 0, sys: 1, released: 0, consumed: 1 (MB)
gc2(2): 0+0+0 ms, 0 -> 0 MB 182 -> 142 (188-46) objects, 1(10) handoff, 1(1) steal,
32/7/0 yields
err dial tcp 127.0.0.1:14356: connection refused
here
real    2m0.014s
user    0m0.007s
sys 0m0.007s
The err appears to be returned immediately after gc2

@davecheney
Copy link
Contributor

Comment 6:

If the GC is turned off, the program unwedges itself as soon as the scvg forces a GC
odessa(~/src) % time GOGC=off GOMAXPROCS=4 GOGCTRACE=1 ./rog 
dialling
scvg0: GC forced
scvg0: inuse: 0, idle: 0, sys: 1err dial tcp 127.0.0.1:14356: connection refused
, released: 0, consumed: here
1 (MB)
real    1m0.013s
user    0m0.007s
sys 0m0.006s

@dvyukov
Copy link
Member

dvyukov commented Apr 7, 2013

Comment 7:

Sent https://golang.org/cl/8459043/

Owner changed to @dvyukov.

@dvyukov
Copy link
Member

dvyukov commented Apr 7, 2013

Comment 8:

This issue was closed by revision 0b5d559.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants