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: panics on net.Listen("tcp", "") #3548

Closed
remyoudompheng opened this issue Apr 18, 2012 · 7 comments
Closed

net: panics on net.Listen("tcp", "") #3548

remyoudompheng opened this issue Apr 18, 2012 · 7 comments

Comments

@remyoudompheng
Copy link
Contributor

What steps will reproduce the problem?
1. Run

package main

import (
      "fmt"
      "net"
)

func main() {
      _, err := net.Listen("tcp", "")
      fmt.Println(err)
}

What is the expected output? What do you see instead?

Expected:
missing port in address

Got:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x38 pc=0x43750e]

goroutine 1 [running]:
net.favoriteAddrFamily(0x4d2624, 0x7f1c00000003, 0x0, 0x0, 0x0, ...)
    /build/src/release-build/src/pkg/net/ipsock_posix.go:100 +0xc3
net.internetSocket(0x4d2624, 0x7f1c00000003, 0x0, 0x0, 0x0, ...)
    /build/src/release-build/src/pkg/net/ipsock_posix.go:127 +0xd9
net.ListenTCP(0x4d2624, 0x7473696c00000003, 0x0, 0x70637400000003, 0x0, ...)
    /build/src/release-build/src/pkg/net/tcpsock_posix.go:302 +0xc2
net.Listen(0x4d2624, 0x70637400000003, 0x4d17e4, 0x0, 0x47fdf8, ...)
    /build/src/release-build/src/pkg/net/dial.go:188 +0x1e3
main.main()
    /tmp/test.go:9 +0x3d

goroutine 2 [syscall]:
created by runtime.main
    /build/src/release-build/src/pkg/runtime/proc.c:221
exit status 2
@davecheney
Copy link
Contributor

Comment 1:

I starter to look into this last night. Unless someone else gets to this before me I'll
tackle it once issue #3507 is closed.

@remyoudompheng
Copy link
Contributor Author

Comment 2:

I am told it should not give an error but listen on a wildcard address. I'm not sure
what is the expected behaviour

@davecheney
Copy link
Contributor

Comment 3:

So net.Listen("tcp", "") is the equivalent of net.Listen("tcp", ":0"), so to speak ?

@ianlancetaylor
Copy link
Contributor

Comment 4:

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

@mikioh
Copy link
Contributor

mikioh commented Apr 24, 2012

Comment 5:

I'd prefer comment on favoriteAddrFamily, so this is a Wild-Wild listen.

@mikioh
Copy link
Contributor

mikioh commented Apr 24, 2012

Comment 6:

http://golang.org/cl/6119043/

@mikioh
Copy link
Contributor

mikioh commented Apr 25, 2012

Comment 7:

This issues was fixed by revision: b07591eb8077.

Status changed to Fixed.

@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

5 participants