SIGSEGV in Java_com_fazecast_jSerialComm_SerialPort_setEventListeningStatus+0x4 · Issue #625 · Fazecast/jSerialComm · GitHub
Skip to content

SIGSEGV in Java_com_fazecast_jSerialComm_SerialPort_setEventListeningStatus+0x4 #625

Open

Description

@HanyzPAPU

Called from Thread.run() in SerialPortEventListener.startListening().

Looks like there's a race with closing the port or shutting down, that the portHandle is set to 0 before the native code is called.
The native code then dereferences the null pointer here:

Activity

  1. HanyzPAPU commented on Feb 12, 2026

    @HanyzPAPU
    Author

    I think it can happen if SerialPort.closePort() is called from the user event handler. The wait for the event thread is bypassed, the port is closed and portHandle set to 0, and after that the event thread exits its loop and tries to call setEventListeningStatus(portHandle, false);.

  2. HanyzPAPU commented on Feb 12, 2026

    @HanyzPAPU
    Author

    I see that it is fixed for LISTENING_EVENT_PORT_DISCONNECTED in 5966a40, but it can still happen for other events.

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