SimpleBluetoothLibrary icon indicating copy to clipboard operation
SimpleBluetoothLibrary copied to clipboard

Fatal SIGSEGV 11 Error

Open DeveloperPaul123 opened this issue 9 years ago • 6 comments

Calling simplebluetooth.endSimpleBluetooth() causes a system crash if your bluetooth socket is recieving information while you are closing the socket, resulting in a fatal segmentation error. This is probably due to trying to access the socket input stream after the socket is closed. Should try to synchronize calls to ending all the separate threads and add a flag so that when thread.cancel() is called, the input stream is never accessed (boolean flag or look at isInterrupted()).

DeveloperPaul123 avatar Apr 13 '15 03:04 DeveloperPaul123

It's not a bug in onDestroy method, before you write simpleBluetooth.endSimpleBluetooth(), write simpleBluetooth.getBluetoothUtility().closeConnections(), to make sure you close everything.This way you will have a clean app close.

greenspand avatar May 28 '15 10:05 greenspand

Thank you for the comment. Have you confirmed that this works? I haven't had a chance to test it.

DeveloperPaul123 avatar May 29 '15 17:05 DeveloperPaul123

I confirm it works.I haven't received any errors. I will post the code tomorrow. On May 29, 2015 7:11 PM, "DeveloperPaul123" [email protected] wrote:

Thank you for the comment. Have you confirmed that this works? I haven't had a chance to test it.

— Reply to this email directly or view it on GitHub https://github.com/DeveloperPaul123/SimpleBluetoothLibrary/issues/1#issuecomment-106874038 .

greenspand avatar May 29 '15 19:05 greenspand

If you look at the method endSimpleBluetooth in the SimpleBluetooth class, I am already calling bluetoothUtility.closeConnections()

DeveloperPaul123 avatar Jun 11 '15 22:06 DeveloperPaul123

I confirm this is NOT a valid work around but sometimes doesn't crash. I have another issue if after calling bluetoothUtility.closeConnections(); bluetoothUtility. endSimpleBluetooth();

If I want to do a SCAN again the library is always crashing. I even tried to put a delay before closing BT and starting it again.

A/libc: Fatal signal 11 (SIGSEGV) at 0x00000008 (code=1)

dabitdev avatar Aug 05 '16 00:08 dabitdev

@DavidBcn I'm not sure what work around you're alluding to. Can you clarify?

If you want to do another scan after closing the library you'll have to initialize. Also you should use the SimpleBluetooth class instead of the BluetoothUtility class to simplify things.

DeveloperPaul123 avatar Aug 10 '16 02:08 DeveloperPaul123