Status 129: Error discovering Bluetooth Services

Hi Eric,

Often, when I attempt to access a MetaWear R-Series device from my Android phone, I get a connection failure with error code 129 and the following traceback:

Throwable java.lang.RuntimeException: Error discovering Bluetooth services
Error connecting to MetaWear
java.lang.RuntimeException: Error discovering Bluetooth services
     at com.mbientlab.metawear.MetaWearBleService$2$4.run(MetaWearBleService.java:941)
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
     at java.lang.Thread.run(Thread.java:818)

This problem appears on every MetaWear device I have thoroughly tested. The MetaWear devices exhibiting this bug are running the newest version of the firmware and have their batteries fully-charged. I have not tested whether this bug is exhibited on older versions of the firmware, but if memory serves it does. The Android phone in question does not have it's Bluetooth disabled.

The MetaWear device will sometimes resolve this problem itself when I disconnect and reconnect several times. Unfortunately, this method can take a bit of time and can be unreliable, which causes problems for our customers.

What would be the best way to resolve this problem?

Best regards,
Joseph Toles

Whatever the case, I am happy to perform testing, offer github access, etc. if this will help you diagnose the problem.

Comments

  • To clarify, this appears eventually on every MetaWear device I have thoroughly tested. It does not necessarily appear immediately and the device often functions properly for a while between incidents of this bug appearing.
  • Further clarification: I have only used MetaWear R-Series devices. I do not know if this bug is present on other devices.
    • What android device and OS are you using?
    • Does the same issue occur on other Bluetooth apps such as the nRF Connect app?
  • edited September 2016
    Thanks for the quick response! Thanks especially for the advice to use nRF Connect. The Google Play
    MetaWear app has a lot of bugs so when I use it it's hard to tell what's
    a bug with my app and what's a bug with the Google Play MetaWear app.

    I think fixed the bug in my app. I will need to test it over the course of a few days to be sure but it looks like the problem is solved. If so, you guys rock. If not, you guys still rock.

    The problem was not intermittent. It was triggered whenever I shut down my phone while connected to the MetaWear. When I turned on the phone and reopened the app I would get a 133. After some time the 133 would go away and be replaced by a 129. After some more time the R-Series would be back to normal.

    The root cause of this comes down to a multithreading bug. I set up the accelerometer in two different threads when I intended to only do so in one thread. I've removed the unnecessary accelerometer setup. I still get a 133 when I do this, but the error is now recoverable. Resetting the connection (which I do in code) resolves the error. (Prior to this fix, disconnecting and reconnecting to the MetaWear would not resolve the 133.)

    Thank you a ton for your support.

    For the record, here's a traceback of the 133 error.

    java.lang.RuntimeException: onConnectionStateChanged reported non-zero status: 133
        at com.mbientlab.metawear.MetaWearBleService$2$2.run(MetaWearBleService.java:991)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)

    Also for the record, I'm using a Samsung Galaxy S6 model number SM-G900V with Android version 5.0.
This discussion has been closed.