Bug#1051259: librxtx-java: SIGSEGV while reading serial port
Petr Mikše
edsbyte at volna.cz
Tue Sep 5 13:34:25 BST 2023
Package: librxtx-java
Version: 2.2.0+dfsg-2
Severity: important
X-Debbugs-Cc: edsbyte at volna.cz
Dear Maintainer,
I am not able to read a serial port using this library.
I've this routine to open the port:
private static RXTXPort open(String portName, int baud) {
System.out.print("Serial.open " + portName + " at " + Integer.toString(baud) + " Baud\n");
RXTXPort rxtxPort = null; // suppose no port is open
try {
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
if (portIdentifier.isCurrentlyOwned()) {
System.err.print("EWC: Error: " + portName + " is currently in use\n");
} else {
CommPort commPort = portIdentifier.open(BootLoader.class.getName(), 2000);
if (commPort instanceof RXTXPort) {
rxtxPort = (RXTXPort) commPort;
rxtxPort.setSerialPortParams(baud, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
System.out.print(portName + " open at " + Integer.toString(rxtxPort.getBaudRate()) + " Baud\n");
//Test it
rxtxPort.getOutputStream().write(255);
System.out.print("Writen: 255\n");
System.out.print("Read: " + Integer.toString(rxtxPort.getInputStream().read()) + '\n');
} else {
System.err.print("EWC: Error: Only serial ports may be used.\n");
}
}
} catch (Exception ex) {
System.err.println(ex);
//ex.printStackTrace();
}
return rxtxPort;
}
The output is:
Serial.open /dev/ttyS0 at 115200 Baud
/dev/ttyS0 open at 115200 Baud
Writen: 255
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fd2b4009762, pid=9221, tid=9222
#
# JRE version: OpenJDK Runtime Environment (11.0.20+8) (build 11.0.20+8-post-Debian-1deb11u1)
# Java VM: OpenJDK 64-Bit Server VM (11.0.20+8-post-Debian-1deb11u1, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C [librxtxSerial-2.1-7.so+0x7762] read_byte_array+0x52
#
# Core dump will be written. Default location: Core dumps may be processed with "/lib/systemd/systemd-coredump %P %u %g %s %t 9223372036854775808 %h" (or dumping to /mnt/JESSIE/opt/ewcs/bin/core.9221)
#
# An error report file with more information is saved as:
# /tmp/hs_err_pid9221.log
If I copy /usr/lib/jni from bullseye to /usr/lib, the output is:
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2
native lib Version = RXTX-2.2pre2
Serial.open /dev/ttyS0 at 115200 Baud
/dev/ttyS0 open at 115200 Baud
Writen: 255
Read: 255
and continues correctly.
-- System Information:
Debian Release: 12.1
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.1.0-11-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages librxtx-java depends on:
ii libc6 2.36-9+deb12u1
librxtx-java recommends no packages.
librxtx-java suggests no packages.
-- no debconf information
More information about the pkg-java-maintainers
mailing list