kura icon indicating copy to clipboard operation
kura copied to clipboard

SIGSEGV fatal error on USB device attach/detach with usb4java and oshi

Open s-leo opened this issue 2 years ago • 6 comments

Describe the bug A SIGSEGV fatal error occurs when USB devices get attached/detached and both the usb4java and oshi libraries are called, with usb4java being called first.

To Reproduce

  1. Compile and deploy this test bundle to Kura.
  2. Wait for the message OshiTestService - SLEEP END to be printed to console.
  3. Attach or detach any USB device.
  4. As Kura crashes, check the kura-console.log file for additional information.

Expected behavior Using both usb4java and oshi should not cause a SIGSEGV fatal error.

Target Environment

  • Kura 5.1.1 Intel UP2 Ubuntu 20 64bit (no network admin)
  • Ubuntu 20.04
  • Java 8 (OpenJDK 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07 )

Additional context Not sure who's at fault here, but deploying the test bundle I linked above to another OSGi framework (tried with Apache Karaf) does not cause the issue, so I would exclude both oshi and usb4java from being at fault. Maybe the re-wrap of native libraries such as libudev by Kura is at fault? I noticed that usb4java makes use of libusb while oshi makes use of libudev, so I'm guessing something is going on with native libraries here.

Here's the log of the crash (full log attached below):

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fec0d28fafe, pid=3378, tid=0x00007febf0479700
#
# JRE version: OpenJDK Runtime Environment (8.0_312-b07) (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07)
# Java VM: OpenJDK 64-Bit Server VM (25.312-b07 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libc.so.6+0x183afe]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /opt/eclipse/kura_5.1.1_intel-up2-ubuntu-20-nn/hs_err_pid3378.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

hs_err_pid3378.log

s-leo avatar Jul 05 '22 15:07 s-leo

I have the same problem myself and it is quite serious. Can you please check it out?

davide-prade avatar Jul 21 '22 08:07 davide-prade

@s-leo I cannot download the test bundle since it is private... Could you share it, so we can test on a device? Thanks!

pierantoniomerlino avatar Jul 21 '22 08:07 pierantoniomerlino

@s-leo I cannot download the test bundle since it is private... Could you share it, so we can test on a device? Thanks!

my bad, I forgot to make it public. You should be able to see it now

s-leo avatar Jul 21 '22 08:07 s-leo

@s-leo I tried your test bundle also on a RPi3 with the same SIGSEGV. Without the bundle, indeed, the usb events are correctly caught and no crash accours. Definitely, more investigation is needed...

pierantoniomerlino avatar Aug 03 '22 15:08 pierantoniomerlino

Any news on the issue @pierantoniomerlino ?

s-leo avatar Sep 28 '22 09:09 s-leo

Hi @s-leo, sorry for the late reply. I should admit that I wasn't able to find the cause of this issue... I've planned to come back to this as soon as possible.

pierantoniomerlino avatar Oct 04 '22 08:10 pierantoniomerlino