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

runtime: Finalizers do not work with CGO at tip #7375

Closed
slimsag opened this issue Feb 20, 2014 · 9 comments
Closed

runtime: Finalizers do not work with CGO at tip #7375

slimsag opened this issue Feb 20, 2014 · 9 comments
Milestone

Comments

@slimsag
Copy link

slimsag commented Feb 20, 2014

What steps will reproduce the problem?
1. http://play.golang.org/p/kjVVgAFRuz
2. 'go install finalizerbug'
3. run

What is the expected output?
The program should not crash and should continue operating normally.

What do you see instead?


unexpected fault address 0x813420
fatal error: fault
[signal 0xb code=0x1 addr=0x813420 pc=0x813420]

goroutine 20 [running]:
runtime.throw(0x75e2d7)
    /home/stephen/go/src/pkg/runtime/panic.c:464 +0x69 fp=0x7f8c50460f80
runtime: unexpected return pc for runtime.sigpanic called from 0x813420
runtime.sigpanic()
    /home/stephen/go/src/pkg/runtime/os_linux.c:237 +0x11b fp=0x7f8c50460f98
created by runtime.gc
    /home/stephen/go/src/pkg/runtime/mgc0.c:2188

goroutine 16 [sleep]:
time.Sleep(0x3b9aca00)
    /home/stephen/go/src/pkg/runtime/time.goc:31 +0x31
main.main()
    /home/stephen/Desktop/godev/src/finalizerbug/finalizerbug.go:27 +0xa9


Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
$ uname -a
Linux stephen-N5110 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64
x86_64 x86_64 GNU/Linux

Which version are you using?  (run 'go version')
(tip)
go version devel +b5eda189b974 Thu Feb 20 16:18:05 2014 -0500 linux/amd64

Please provide any additional information below.

It appears as though using finalizers causes a crash during GC when just importing CGO
(not even really using it). The same program will compile and run normally if the
'import "C"' line is removed.
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-go1.3.

@gopherbot
Copy link

Comment 2 by capnm9:

This broke here the build on current tip:
tag:         tip
user:        Russ Cox <rsc@golang.org>
date:        Fri Feb 21 13:51:22 2014 -0500
summary:     reflect: better error for walking through nil embedded struct pointer
Linux 3.8.0-35-generic #50-Ubuntu SMP Tue Dec 3 01:24:59 UTC 2013 x86_64 x86_64 x86_64
GNU/Linux
# GOMAXPROCS=2 runtime -cpu=1,2,4
--- FAIL: TestFinalizerInterfaceBig-2 (4.00 seconds)
    mfinal_test.go:100: finalizer for type *bigValue didn't run
FAIL
FAIL    runtime 45.786s

@slimsag
Copy link
Author

slimsag commented Feb 22, 2014

Comment 3:

capnm9, did you mean to say that CL caused this issue?
That CL was submitted Feb 21, this issue was submitted on the 20th, so I don't
understand how that could have caused it.

@slimsag
Copy link
Author

slimsag commented Feb 22, 2014

Comment 4:

I've stepped through each change and found the one that causes this program to crash, it
is:
changeset:   19063:e1d8f233470b
user:        Dmitriy Vyukov <dvyukov@google.com>
date:        Wed Feb 12 22:16:42 2014 +0400
summary:     runtime: concurrent GC sweep

@gopherbot
Copy link

Comment 5 by capnm9:

> did you mean to say that CL caused this issue?
Of course not. I found that just at that point in the log of our internal builder.

@dvyukov
Copy link
Member

dvyukov commented Feb 24, 2014

Comment 6:

https://golang.org/cl/67850044

Owner changed to @dvyukov.

Status changed to Started.

@dvyukov
Copy link
Member

dvyukov commented Feb 24, 2014

Comment 7:

This issue was closed by revision 0ef0d6c.

Status changed to Fixed.

@4ad
Copy link
Member

4ad commented Mar 12, 2014

Comment 8:

mfinal_test.go:100: finalizer for type *bigValue didn't run
People still see this, reported today in #go-nuts. I have also seen it. Could be related
to issue #7511.

@4ad
Copy link
Member

4ad commented Mar 12, 2014

Comment 9:

Failure reported on #go-nuts happened on linux/amd64.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 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

6 participants