My app loops through a set of BluetoothDevices that it gets from BluetoothManager like this:
List<BluetoothDevice> loggerDevices = BluetoothManager.getBluetoothManager().getDevices();
For each device it connects, enumerates the services, enumerates the characteristics within each service, enables notification on one of those characteristics, writes some bytes into one characteristic, handles response bytes arriving as a notification, and then disconnects. Eventually the app will crash - my app log always shows that the crash probably occurred in the TinyB disconnect() call.
Here's a snippet from the app log, at the crash (app is running on a RaspberryPi, invoked by NetBeans running on a Mac). In the code, the next thing that happens after the red logged line below is this:
2017-04-27 18:02:29.949 [Thread-3] INFO main.java.com.onset.gateway.Services.LoggerAccessManager - runLoop: Authentication for device succeeded, connection completed
2017-04-27 18:02:29.950 [Thread-3] DEBUG main.java.com.onset.gateway.Services.LoggerAccessManager - runLoop: Disconnecting from device
2017-04-27 18:02:29.950 [Thread-3] DEBUG main.java.com.onset.gateway.Components.LoggerObjectTinyB - disconnect: entered, disconnecting from device (E0:93:3D:AF:67:50)
2017-04-27 18:02:29.950 [Thread-3] DEBUG main.java.com.onset.gateway.Components.LoggerObjectTinyB - disconnect: Disabling notifications on the Command characteristic
# A fatal error has been detected by the Java Runtime Environment:
# SIGSEGV (0xb) at pc=0x610dfaf8, pid=12803, tid=1654649952
# JRE version: Java(TM) SE Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17)
# Java VM: Java HotSpot(TM) Client VM (25.65-b01 mixed mode linux-arm )
# Problematic frame:
# 2017-04-27 18:02:29.952 [Thread-3] DEBUG main.java.com.onset.gateway.Components.LoggerObjectTinyB - disconnect: About to disconnect from the logger, after a .5-second wait...
# 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:
# If you would like to submit a bug report, please visit:
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
bash: line 1: 12803 Aborted '/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java' -Dfile.encoding=UTF-8 -Djava.library.path=/usr/local/lib/:/usr/local/lib/java/:/usr/lib:/usr/lib/arm-linux-gnueabihf -jar /home/pi/NetBeansProjects//ITCgateway/dist/ITCgateway.jar
/Users/dfclark/NetBeansProjects/ITCgateway/nbproject/remote-platform-impl.xml:105: The following error occurred while executing this line:
/Users/dfclark/NetBeansProjects/ITCgateway/nbproject/remote-platform-impl.xml:63: Remote command failed with exit status 134
BUILD FAILED (total time: 59 minutes 35 seconds)