Issue 7857 in go: net: SIGSEGV: segmentation violation .. net.cgoLookupIPCNAME

206 views
Skip to first unread message

g...@googlecode.com

unread,
Apr 24, 2014, 2:27:35 AM4/24/14
to golan...@googlegroups.com
Status: New
Owner: ----

New issue 7857 by storm...@gmail.com: net: SIGSEGV: segmentation
violation .. net.cgoLookupIPCNAME
http://code.google.com/p/go/issues/detail?id=7857


My go program crashed with errors:

SIGSEGV: segmentation violation
PC=0x3841478ce2
signal arrived during cgo execution

runtime.cgocall(0x4016c0, 0x7f60b4257748)
/usr/local/go/src/pkg/runtime/cgocall.c:149 +0x11b fp=0x7f60b4257738
runtime.cmalloc(0x15)
/usr/local/go/src/pkg/runtime/cgocall.c:200 +0x47 fp=0x7f60b4257760
net._Cfunc_CString(0xc211d68860, 0x14, 0x7f60fd34bf40)
net/_obj/_cgo_defun.c:31 +0x2a fp=0x7f60b4257780
net.cgoLookupIPCNAME(0xc211d68860, 0x14, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/pkg/net/cgo_unix.go:94 +0x124 fp=0x7f60b4257858
net.cgoLookupIP(0xc211d68860, 0x14, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/pkg/net/cgo_unix.go:148 +0x69 fp=0x7f60b42578b0
net.lookupIP(0xc211d68860, 0x14, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/pkg/net/lookup_unix.go:64 +0x63 fp=0x7f60b42578f8
net.func·022(0xc96680, 0xc210071000, 0xc211d68860, 0x14)
/usr/local/go/src/pkg/net/lookup.go:41 +0x2d fp=0x7f60b4257948
net.(*singleflight).Do(0xc96680, 0xc211d68860, 0x14, 0x7f60b42579e0,
0x0, ...)
/usr/local/go/src/pkg/net/singleflight.go:45 +0x1de
fp=0x7f60b4257990
net.lookupIPMerge(0xc211d68860, 0x14, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/pkg/net/lookup.go:42 +0xc0 fp=0x7f60b4257a40
net.lookupIPDeadline(0xc211d68860, 0x14, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/pkg/net/lookup.go:57 +0xd0 fp=0x7f60b4257ac8
net.resolveInternetAddr(0x747960, 0x3, 0xc211d68860, 0x17, 0x0, ...)
/usr/local/go/src/pkg/net/ipsock.go:285 +0x395 fp=0x7f60b4257b80
net.resolveAddr(0x73b9e0, 0x4, 0x747960, 0x3, 0xc211d68860, ...)
/usr/local/go/src/pkg/net/dial.go:104 +0x32a fp=0x7f60b4257c18
net.(*Dialer).Dial(0x7f60b4257d78, 0x747960, 0x3, 0xc211d68860, 0x17, ...)
/usr/local/go/src/pkg/net/dial.go:153 +0xa7 fp=0x7f60b4257d30
net.Dial(0x747960, 0x3, 0xc211d68860, 0x17, 0x5126be, ...)
/usr/local/go/src/pkg/net/dial.go:138 +0x75 fp=0x7f60b4257db8
net/http.(*Transport).dial(0xc210059200, 0x747960, 0x3, 0xc211d68860,
0x17, ...)
/usr/local/go/src/pkg/net/http/transport.go:401 +0xd4
fp=0x7f60b4257e00
net/http.(*Transport).dialConn(0xc210059200, 0xc212d82330, 0xc21339d380,
0x0, 0x0)
/usr/local/go/src/pkg/net/http/transport.go:444 +0x6e
fp=0x7f60b4257f50
net/http.func·014()
/usr/local/go/src/pkg/net/http/transport.go:419 +0x3e
fp=0x7f60b4257fa0
runtime.goexit()
/usr/local/go/src/pkg/runtime/proc.c:1394 fp=0x7f60b4257fa8
created by net/http.(*Transport).getConn
/usr/local/go/src/pkg/net/http/transport.go:421 +0x11a

In my program, I only used http.PostForm(), somebody said disable cgo may
be worked.
but I have used cgo to replace bytes.Buffer.
So is there a good solution to avoid this crash?

some of my go code:
//Post start_time or end_time or Log
func PostCronData(apitype string, v *url.Values) (ret []byte, err error) {
var api string
switch apitype {
case "log":
api = fmt.Sprintf("http://%s%s", Config.domain,
Config.postLogApi)
case "time":
api = fmt.Sprintf("http://%s%s", Config.domain,
Config.updateTimeApi)
default:
return nil, errors.New(fmt.Sprintf("Can not find such
api: %s", apitype))
}
// fmt.Println("Api:", api)
DLogger.Debug("Api: %s", api)
resp, err := http.PostForm(api, *v)
if err != nil {
return nil, err
}
defer resp.Body.Close()
var buf []byte
buf, err = ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
ret = buf
return
}

thx u all !

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

g...@googlecode.com

unread,
Apr 24, 2014, 2:35:49 AM4/24/14
to golan...@googlegroups.com

Comment #1 on issue 7857 by dvyu...@google.com: net: SIGSEGV: segmentation
violation .. net.cgoLookupIPCNAME
http://code.google.com/p/go/issues/detail?id=7857

> but I have used cgo to replace bytes.Buffer.

How do you do it? Corrupted C heap would explain he crash.

g...@googlecode.com

unread,
Apr 24, 2014, 9:10:44 AM4/24/14
to golan...@googlegroups.com
Updates:
Labels: Repo-Main Release-Go1.3Maybe

Comment #2 on issue 7857 by i...@golang.org: net: SIGSEGV: segmentation
violation .. net.cgoLookupIPCNAME
http://code.google.com/p/go/issues/detail?id=7857

Which version of go are you using?

Can you show us your cgo code?

g...@googlecode.com

unread,
May 9, 2014, 3:06:29 PM5/9/14
to golan...@googlegroups.com
Updates:
Status: TimedOut

Comment #3 on issue 7857 by r...@golang.org: net: SIGSEGV: segmentation
violation .. net.cgoLookupIPCNAME
http://code.google.com/p/go/issues/detail?id=7857

(No comment was entered for this change.)

g...@googlecode.com

unread,
Dec 8, 2014, 12:18:15 PM12/8/14
to golan...@googlegroups.com

Comment #4 on issue 7857 by trae...@gmail.com: net: SIGSEGV: segmentation
violation .. net.cgoLookupIPCNAME
https://code.google.com/p/go/issues/detail?id=7857

would like to revive this issue for trunk.

Currently causing a segmentation fault on debian squeeze due to similar
issues.

Crash occurs when running 'go test' on the 'net' package, also occurs when
performing a 'go get' on a domain name that is not locally cached (e.g.
requires a little time to actually perform the resolve).

I believe this is related to the libnss bug here:
https://bugzilla.redhat.com/show_bug.cgi?id=89698

backtrace is attached for 'go test -v' on net package.

Attachments:
backgrace.txt 19.1 KB

g...@googlecode.com

unread,
Dec 9, 2014, 4:37:41 PM12/9/14
to golan...@googlegroups.com

Comment #6 on issue 7857 by a...@golang.org: net: SIGSEGV: segmentation
violation .. net.cgoLookupIPCNAME
https://code.google.com/p/go/issues/detail?id=7857

@traetox: please repost your comment here https://golang.org/issue/7857
Reply all
Reply to author
Forward
0 new messages