Closed michieltjampens closed 2 years ago
Hi Fazecast,
thank you for the great work! I like to use your serial port drivers very much as they really enable cross platform development for serial devices (https://www.metacodes.pro/funcodes/blog/using_tty2mqtt_to_bridge_between_serial_communication_and_mqtt/)!
Since v2.9.1 I encountered the same issue, both on Windows 10 and Windows 7 (see the JVM's error log below), but the error did not(!) occur on all Windows 10 machines I was testing:
com.fazecast.jSerialComm.SerialPort.closePortNative(J)J+0
Thanks beforehand and best regards, Siegfried
The issue occurs both on GraalVM (first log snippet) as well as on Azul's JVM (second log snippet).
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000077982ad4, pid=6740, tid=7768
#
# JRE version: OpenJDK Runtime Environment (17.0.2+8) (build 17.0.2+8-jvmci-22.0-b05)
# Java VM: OpenJDK 64-Bit Server VM (17.0.2+8-jvmci-22.0-b05, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C [ntdll.dll+0x32ad4]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# https://github.com/oracle/graal/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- S U M M A R Y ------------
Command Line: -Djpackage.app-version=0.2.0 -Djpackage.app-path=C:\Program Files\tty2mqtt-installer-x86_64\tty2mqtt-installer-x86_64.exe club.funcodes.tty2mqtt.Main --config tty2mqtt.ini
Host: Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz, 4 cores, 15G, Windows 7 , 64 bit Build 7601 (6.1.7601.24545)
Time: Thu May 19 18:21:03 2022 Öйú±ê׌ʱŒä elapsed time: 374.926447 seconds (0d 0h 6m 14s)
--------------- T H R E A D ---------------
Current thread (0x0000000000262010): JavaThread "main" [_thread_in_native, id=7768, stack(0x00000000022a0000,0x00000000023a0000)]
Stack: [0x00000000022a0000,0x00000000023a0000], sp=0x000000000239f220, free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [ntdll.dll+0x32ad4]
C [ntdll.dll+0x2d261]
C [1652955292497-jSerialComm.dll+0x3cb2]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.fazecast.jSerialComm.SerialPort.closePortNative(J)J+0
j com.fazecast.jSerialComm.SerialPort.closePort()Z+29
j org.refcodes.serial.alt.tty.TtyPort.close()V+8
j club.funcodes.tty2mqtt.Main.<init>(Lorg/refcodes/properties/ext/runtime/RuntimeProperties;)V+1171
j club.funcodes.tty2mqtt.Main.main([Ljava/lang/String;)V+979
v ~StubRoutines::call_stub
siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), writing address 0x0000000000000024
...
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000077462ad4, pid=2656, tid=10000
#
# JRE version: OpenJDK Runtime Environment Zulu18.30+11-CA (18.0.1+10) (build 18.0.1+10)
# Java VM: OpenJDK 64-Bit Server VM Zulu18.30+11-CA (18.0.1+10, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C [ntdll.dll+0x32ad4]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://www.azul.com/support/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- S U M M A R Y ------------
Command Line: -Djpackage.app-version=0.2.0 -Djpackage.app-path=C:\Program Files\tty2mqtt-installer-x86_64\tty2mqtt-installer-x86_64.exe club.funcodes.tty2mqtt.Main --config tty2mqtt.ini
Host: Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz, 4 cores, 15G, Windows 7 , 64 bit Build 7601 (6.1.7601.24545)
Time: Sun May 22 10:25:40 2022 Öйú±ê׌ʱŒä elapsed time: 79.787753 seconds (0d 0h 1m 19s)
--------------- T H R E A D ---------------
Current thread (0x00000000000e54f0): JavaThread "main" [_thread_in_native, id=10000, stack(0x00000000023f0000,0x00000000024f0000)]
Stack: [0x00000000023f0000,0x00000000024f0000], sp=0x00000000024eed00, free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [ntdll.dll+0x32ad4]
C [ntdll.dll+0x2d261]
C [1653186264810-jSerialComm.dll+0x3cb2]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.fazecast.jSerialComm.SerialPort.closePortNative(J)J+0
j com.fazecast.jSerialComm.SerialPort.closePort()Z+29
j org.refcodes.serial.alt.tty.TtyPort.close()V+8
j club.funcodes.tty2mqtt.Main.<init>(Lorg/refcodes/properties/ext/runtime/RuntimeProperties;)V+1171
j club.funcodes.tty2mqtt.Main.main([Ljava/lang/String;)V+979
v ~StubRoutines::call_stub
siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), writing address 0x0000000000000024
...
Sorry for the delay in addressing this issue - I had a difficult time coming up with the root cause (it appears to have been due to exiting a critical section in native code after the VM had mostly shut down). Please test the following beta version of the library and see if it resolves your issue:
Delay wasn't an issue given that the previous version worked fine. If i replace the 2.9.1 in my local repo with the dropbox beta, the issue no longer presents itself. Thanks for fixing it.
Great! Since the crash frame offset was identical for both you and @metacodez, I will assume this fix works for both of you. It will be released in v2.9.2
Hello @hedgecrw,
Great! Since the crash frame offset was identical for both you and @metacodez, I will assume this fix works for both of you. It will be released in v2.9.2
Thank you for the fix, the fix works perfect for me as well, great work!
These fixes were included in today's jSerialComm v2.9.2 release. Thanks!
I don't close the ports manually when i quit the program with 2.9.0 that was ok. Since 2.9.1 the jvm crashes on exit. Part of the crash dump.
Full dump: hs_err_pid13412.log Oh, this time no FTDI involved, all serial ports are using CP210x drivers.