-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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, cgo: deadlock at _cgo_wait_runtime_init_done in LD_PRELOAD so #43836
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Comments
source code:
|
dmitshur
added
the
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
label
Jan 22, 2021
dmitshur
changed the title
runtime/cgo: deadlock at _cgo_wait_runtime_init_done in LD_PRELOAD so
runtime, cgo: deadlock at _cgo_wait_runtime_init_done in LD_PRELOAD so
Jan 22, 2021
There's some progress. I use pthread_atfork to ensure runtime init done before fork.
It works. But in the case when I hook execve, deadlock occurs again. Here is the stack.
It seems that there are still some locks which can not be released between different processes. |
gopherbot
added
the
compiler/runtime
Issues related to the Go compiler and/or runtime.
label
Jul 7, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I've compiled a so file to use LD_PRELOAD to hook bash execve. Deadlock occurs when using the LD_PRELOAD so file
What did you expect to see?
What did you see instead?
When I use gdb to debug this, it's stack show:
I've found some clues. I put some debug code in /usr/lib/golang/src/runtime/cgo/gcc_libinit.c to trace the x_cgo_notify_runtime_init_done and _cgo_wait_runtime_init_done.
Here is the log
It's clearly shown that the notify and wait action occur in two different processes(parent process and child process). So deadlock is unavoidable.
The text was updated successfully, but these errors were encountered: