Skip to content

jSerialComm sets signals to be ignored which are reserved for the JVM risking its integrity #612

Open

Description

@kneisslm

Observed behavior

At least on Linux jSerialComm sets several signals to be ignored. This is unsupported behaviour for some signals because these are required by the JVM for their own purposes.

The current behaviour is flagged by the JVM when using the check:jni diagnostic option.

Expected behavior

jSerialComm only modifies signal handlers that are strictly necessary for its operation without interfering with other libraries or the JVM itself. If signal handlers are modified, the JVM mechanisms for doing so should be used.

Steps to reproduce

Watch signal handlers using strace or /proc//status.

Observe that once jSerialComm initializes several signal handers are set to SIG_IGN, including for example SIGUSR2.

Code location is https://github.com/Fazecast/jSerialComm/blob/master/src/main/c/Posix/SerialPort_Posix.c#L336

See also

https://docs.oracle.com/en/java/javase/17/troubleshoot/handle-signals-and-exceptions.html

Activity

  1. hedgecrw commented on Oct 31, 2025

    @hedgecrw
    Contributor

    I'm hesitant to remove the SIGUSR2 ignore handler from the library. The reason it was added in the first place was because whatever the Java VM was doing upon receipt of that signal would cause all sorts of serial port communication issues (disconnects, abnormal reads/writes, etc). Perhaps the JVM has gotten less intrusive over the years, but I'd need a lot of people to do some fairly rigorous testing with this change to ensure that it doesn't cause any new issues. Will think about how best to do this for an upcoming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions