A/libc: Fatal signal 11 (SIGSEGV), code 1


#1

Hi everyone,

I am running the TestLibMuseAndroid example (From now I will call it: the app) to stream and record EEG raw data for research purposes.

The first time I ran the app worked perfectly and did not stop streaming data until my muse headband battery died. However, in the following tries, when I connected the app with my muse headband and it started streaming data, the app crashed. Please see below the error.

I googled the error (SIGSEGV) and apparently it is related to running out of memory.

Does anyone have had the same problem and fixed it?

Thanks,

10-27 17:56:52.552 18223-18223/com.choosemuse.example.libmuse I/TestLibMuseAndroid: CONNECTING -> CONNECTED
10-27 17:56:57.447 18223-18223/com.choosemuse.example.libmuse A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x983c0000 in tid 18223 (example.libmuse)

LOGCAT:
10-29 16:27:44.276: A/DEBUG(315): #00 pc 000e8804 /data/app/com.choosemuse.example.libmuse-1/lib/arm/libmuse_android.so (interaxon::MuseDataPacketImpl::get_eeg_channel_value(interaxon::bridge::Eeg)+40)
10-29 16:27:44.276: A/DEBUG(315): #01 pc 000a0ef8 /data/app/com.choosemuse.example.libmuse-1/lib/arm/libmuse_android.so (Java_com_choosemuse_libmuse_MuseDataPacket_00024CppProxy_native_1getEegChannelValue+52)
10-29 16:27:50.324: I/TrustAgent.Tracker(5484): [BluetoothConnectionTracker] Bluetooth disconnect broadast for Muse-D8C4 00:06:66:77:D8:C4


#2

LOGCAT:

10-29 16:27:44.276: A/DEBUG(315): #00 pc 000e8804 /data/app/com.choosemuse.example.libmuse-1/lib/arm/libmuse_android.so (interaxon::MuseDataPacketImpl::get_eeg_channel_value(interaxon::bridge::Eeg)+40)
10-29 16:27:44.276: A/DEBUG(315): #01 pc 000a0ef8 /data/app/com.choosemuse.example.libmuse-1/lib/arm/libmuse_android.so (Java_com_choosemuse_libmuse_MuseDataPacket_00024CppProxy_native_1getEegChannelValue+52)
10-29 16:27:50.324: I/TrustAgent.Tracker(5484): [BluetoothConnectionTracker] Bluetooth disconnect broadast for Muse-D8C4 00:06:66:77:D8:C4


#3

I have not seen this exact error, but thank you for reporting it.

Have you made any modifications to the sample application? From the look of the logcat, it may be that the code is accessing an AUX_LEFT or AUX_RIGHT value for a data type that only has 4 values (like HSI_PRECISION). This could lead to a crash that would result in a SIGSEGV.


#4

No. I have not moved anything.

I have been reading many StackOverFlow posts regarding the SIGSEGV and apparently this is a memory leak issue (In this case Dalvik cache).

Since the Libmuse Android app works well the first time but then in the following tries it crashes (and according to the error message), perhaps the native library libmuse_android.so does not free cache memory; therefore in the following tries it crashes.

Another error that appears (which might be also related to memor leak) that looks like it is a dalvik memory issue is: **

JNI ERROR (app bug): global reference table overflow (max=51200)

**

10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): global reference table overflow (max=51200)
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] global reference table dump:
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] Last 10 entries (of 51200):
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51199: 0x1482dcc0 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51198: 0x1482dc80 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51197: 0x1482dc40 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51196: 0x1482dc00 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51195: 0x1482dbc0 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51194: 0x1482db80 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51193: 0x1482db40 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51192: 0x1482db00 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51191: 0x1482dac0 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 51190: 0x1482da80 java.lang.ref.WeakReference
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] Summary:
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 2 of com.google.android.gms.internal.zzju$zzd (2 unique instances)
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of com.google.android.gms.common.internal.zzj$zzd
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of com.proj.app1.DataListener
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 3 of com.choosemuse.libmuse.MusePlatformAndroid (3 unique instances)
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of com.choosemuse.libmuse.AndroidLogListener
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of com.choosemuse.libmuse.HandlerEventLoop
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of com.proj.app1.ConnectionListenerAM
10-24 16:50:26.186 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 3 of com.choosemuse.libmuse.AndroidConnectionHandle (3 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 2 of android.view.ViewRootImplAO$WEx (2 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 325 of java.lang.Class (261 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 2 of java.lang.String (2 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 2 of dalvik.system.PathClassLoader (1 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of dalvik.system.VMRuntime
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 2 of java.lang.ThreadGroup (2 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 50836 of java.lang.ref.WeakReference (50836 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of byte[] (36864 elements)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 2 of android.opengl.EGLDisplay (1 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of android.view.WindowManagerGlobal$1
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of android.view.accessibility.AccessibilityManager$1
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of android.view.inputmethod.InputMethodManager$1
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of android.view.inputmethod.InputMethodManager$ControlledInputConnectionWrapper
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of android.app.ActivityThread$ApplicationThread
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of android.bluetooth.BluetoothAdapter$1
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of android.hardware.display.DisplayManagerGlobal$DisplayManagerCallback
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of android.hardware.input.InputManager$InputDevicesChangedListener
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 2 of android.opengl.EGLContext (1 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 2 of android.opengl.EGLSurface (1 unique instances)
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115] 1 of android.os.Binder
10-24 16:50:26.187 1505-1505/com.proj.app1 A/art: art/runtime/indirect_reference_table.cc:115]
10-24 16:50:26.652 1505-1511/com.proj.app1 W/art: Suspending all threads took: 476.494ms


#5

Hi, if you just need EEG waves you may use my application - MuseCSV - it’s free in google play.

P.S. I donno is it ok to post messages like this here, so if this is advertisement please remove it.


#6

So, the issue has been fixed.
The buffer array for EEG data considers the 4 main channels plus the 2 auxiliaries so the length is 6.
I reduced the EEG buffer size to 4 in order to get only the EEG data from the 4 main channels. Now the app does not crash. So I want to assume that trying to get EEG Data from the auxiliaries without really using those channels, was causing the problem.

Hope this finding improve the Muse Android Example.

Thanks anyway,


#7

Hi Dmitriy.

The issue has been solved.

Thanks anyway.