-
Notifications
You must be signed in to change notification settings - Fork 91
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
Signal handler installed with signal() is not triggered after GC #137
Comments
signal
is not triggered after GC
Solved my own problem... looks like the issue was that An additional complication was that you can't use a Kotlin lambda or method reference as the parameter to I've updated my sample repo (https://github.com/charleskorn/jnr-signals-issue) with a workaround for these issues if anyone else runs into them. tl;dr: |
@charleskorn Is there a jnr-posix patch possible here? |
Yes, I think |
I've been having trouble with a signal handler installed with
POSIX.signal()
.It behaves correctly shortly after it is created, but later fails to work. I believe the trigger for it to stop working is a garbage collection run.
I've created a sample application at https://github.com/charleskorn/jnr-signals-issue that installs a signal handler for SIGWINCH and then calls
raise(SIGWINCH)
to invoke it every second. After five seconds, it callsSystem.gc()
to trigger a garbage collection run. Before theSystem.gc()
call, the signal handler is invoked, and afterwards, it is not.If I disable the calls to
raise
and instead usekill -winch <pid>
from the command line, the signal handler is successfully invoked before theSystem.gc()
call, but is not onceSystem.gc()
is called.If you run the application (
./gradlew run
), you'll see output similar to the following:Is there something that I'm doing wrong, or is this an issue in this library or another part of JNR?
The text was updated successfully, but these errors were encountered: