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: function referenced by a function is not GC'd #5493

Closed
neild opened this issue May 17, 2013 · 15 comments
Closed

runtime: function referenced by a function is not GC'd #5493

neild opened this issue May 17, 2013 · 15 comments

Comments

@neild
Copy link
Contributor

neild commented May 17, 2013

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. http://play.golang.org/p/6GSIeo4oKF

What is the expected output?
0: finalize invoke
0: finalize f
1: finalize invoke
1: finalize f
...

What do you see instead?
0: finalize invoke
1: finalize invoke
...

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

Which operating system are you using?
Linux

Which version are you using?  (run 'go version')
Whichever play.golang.org is using.

Please provide any additional information below.
@neild
Copy link
Contributor Author

neild commented May 17, 2013

Comment 1:

n.b., commenting out the f() on line 10 results in the expected output.

@neild
Copy link
Contributor Author

neild commented May 17, 2013

Comment 2:

...and never mind.  The cause of this behavior is the finalizer holding the data live
for longer than normal.  Repeating GC passes results in all the data eventually being
collected.

@remyoudompheng
Copy link
Contributor

Comment 3:

Status changed to Retracted.

@neild
Copy link
Contributor Author

neild commented May 17, 2013

Comment 4:

All right, I think I was on to something, but reduced my test case too far.  I believe
this demonstrates the issue:
http://play.golang.org/p/-XkxEXbpVh

@dvyukov
Copy link
Member

dvyukov commented May 19, 2013

Comment 5:

Owner changed to @dvyukov.

Status changed to Started.

@dvyukov
Copy link
Member

dvyukov commented May 19, 2013

Comment 6:

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

@ianlancetaylor
Copy link
Contributor

Comment 7:

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

@dvyukov
Copy link
Member

dvyukov commented May 20, 2013

Comment 8:

This issue was closed by revision 1308194.

Status changed to Fixed.

@ianlancetaylor
Copy link
Contributor

Comment 9:

Labels changed: removed go1.1.1.

@davecheney
Copy link
Contributor

Comment 10:

I would like to ask that this issue be considered for inclusion in Go 1.1.1, the fix is
only one line, comes with a test, and appears low risk.

@ianlancetaylor
Copy link
Contributor

Comment 11:

We want to make 1.1.1 an absolutely minimal release with only fixes for critical bugs
with no workaround.  This bug only affects when finalizers are run, and that has never
been guaranteed.

@davecheney
Copy link
Contributor

Comment 12:

Okay, thanks for letting me know.

@neild
Copy link
Contributor Author

neild commented May 30, 2013

Comment 13:

This bug can result in garbage going uncollected indefinitely.  I've observed tasks with
hundreds of MB of uncollected and uncollectable garbage as a result of it.  Without
offering an opinion on whether that's worthy of inclusion in Go 1.1.1, I would say that
this is more significant than just affecting when finalizers run.

@ianlancetaylor
Copy link
Contributor

Comment 14:

Labels changed: added go1.1.1.

@adg
Copy link
Contributor

adg commented Jun 5, 2013

Comment 15:

This issue was closed by revision 91ebf3762c9d.

@rsc rsc added this to the Go1.1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1.1 label Apr 14, 2015
adg added a commit that referenced this issue May 11, 2015
…of the closure

««« CL 9557043 / 2c128d417029
runtime: zeroize g->fnstart to not prevent GC of the closure
Fixes #5493.

R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/9557043
»»»

R=dvyukov, iant, minux.ma, bradfitz, dave
CC=golang-dev
https://golang.org/cl/10031043
@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

8 participants