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: signalfd is not working after shared library compiled by cgo is loaded #55066
Comments
What is the output of |
Interesting, when I run it with
But when I run it with
|
Interesting. That suggests that 1) there could be a race between calling |
According to https://pkg.go.dev/os/signal#hdr-Non_Go_programs_that_call_Go_code
Does this initialization happen async? AFAIK, the shared library loading happens before calling |
The real-world case I hit is using |
The Go signal handlers should be installed when you When a Go library is built with I don't know what is happening. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
When I try to call Go code in C, I figure out that the signalfd will stop working. I read https://pkg.go.dev/os/signal#hdr-Non_Go_programs_that_call_Go_code but it doesn't mention
signalfd
.What did you expect to see?
Here is a minimal example:
The C code which calls the Go code:
The Go code:
Compile the Go code with
go build -o libcgo.so -buildmode=c-shared *.go
.Then compile the C code with
clang -L. -lcgo main.c
. After that, run./a.out
.I expected to see:
SIGINT is captured by signalfd.
What did you see instead?
The signalfd is not working.
The text was updated successfully, but these errors were encountered: