-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: go1.3 windows/amd64:system handle leaks in multithread c-callback #8517
Labels
Milestone
Comments
Alex, I think the issue is here: // Called to initialize a new m (including the bootstrap m). // Called on the new thread, can not allocate memory. void runtime·minit(void) { void *thandle; // -1 = current process, -2 = current thread runtime·stdcall(runtime·DuplicateHandle, 7, (uintptr)-1, (uintptr)-2, (uintptr)-1, &thandle, (uintptr)0, (uintptr)0, (uintptr)DUPLICATE_SAME_ACCESS); runtime·atomicstorep(&g->m->thread, thandle); } // Called from dropm to undo the effect of an minit. void runtime·unminit(void) { } We leak the thread handle during each C->Go callback on external thread. We need to close the handle. We can't keep it for later as, I think, extram's are reused across different threads. |
I will try to fix this, but I am busy now. A test would be nice, but ... Calling Go from C on non-Go thread does not work. See issue #6751. I think we should fix both issues. I tried to fix issue #6751 (see diff in https://golang.org/issue/6751?c=3). but that triggers "all goroutines are asleep - deadlock!" panic. I could not work out what needs to be adjusted in checkdead. Alex |
issue #6751 is about syscall.NewCallback, this issue is about cgo callbacks. |
CL https://golang.org/cl/145890044 mentions this issue. |
This issue was closed by revision 88d53dd. Status changed to Fixed. |
CL https://golang.org/cl/148790043 mentions this issue. |
This issue was updated by revision 9ca8368. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/148790043 |
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 25, 2018
Fixes golang#8517. LGTM=dvyukov, alex.brainman R=golang-codereviews, dvyukov, alex.brainman CC=golang-codereviews https://golang.org/cl/145890044
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 9, 2018
Fixes golang#8517. LGTM=dvyukov, alex.brainman R=golang-codereviews, dvyukov, alex.brainman CC=golang-codereviews https://golang.org/cl/145890044
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 30, 2018
Fixes golang#8517. LGTM=dvyukov, alex.brainman R=golang-codereviews, dvyukov, alex.brainman CC=golang-codereviews https://golang.org/cl/145890044
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by policehsh:
Attachments:
The text was updated successfully, but these errors were encountered: