xrucka / bluetooth-manager-dbus

Bluetooth transport implementation bypassing tinyb and using directly dbus binding instead
Apache License 2.0
1 stars 2 forks source link

ClassCastException while accessing RSSI #1

Closed vkolotov closed 6 years ago

vkolotov commented 6 years ago

Hi @xrucka, I finally found some time to try to "productionize" your great effort to bring a proper support for DBus based adapters.

Good news - it is working! Bloody good news! You are rock!

Now, there are few issues we need to resolve. I'll be adding them one by one. Here is the first one.

Caused by: java.lang.ClassCastException: java.lang.Short cannot be cast to org.freedesktop.dbus.Variant
    at cz.organovabanka.bluetooth.manager.transport.dbus.PropertyCache.get(PropertyCache.java:59) ~[?:?]
    at cz.organovabanka.bluetooth.manager.transport.dbus.BluezDevice.getRSSI(BluezDevice.java:538) ~[?:?]
    at cz.organovabanka.bluetooth.manager.transport.dbus.BluezAdapter.lambda$getDevices$13(BluezAdapter.java:262) ~[?:?]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) ~[?:?]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:?]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:?]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:?]
    at java.util.TreeMap$KeySpliterator.forEachRemaining(TreeMap.java:2746) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:?]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:?]
    at cz.organovabanka.bluetooth.manager.transport.dbus.BluezAdapter.getDevices(BluezAdapter.java:263) ~[?:?]
xrucka commented 6 years ago

Hi, I'm having trouble reproducing the error. Can you please provide me with further info, perhaps debug logs concerning dbus + device interaction?

I've attempted to fix this bug by rewriting the corresponding part in 79616ca, can you please check whether the issue got fixed?

vkolotov commented 6 years ago

I do nothing special... Here is another one:

15:03:04.158 [WARN ] [oth.manager.impl.BluetoothManagerImpl] - Device discovery job error
java.lang.ClassCastException: java.lang.String cannot be cast to org.freedesktop.dbus.Variant
    at cz.organovabanka.bluetooth.manager.transport.dbus.PropertyCache.get(PropertyCache.java:59) ~[?:?]
    at cz.organovabanka.bluetooth.manager.transport.dbus.BluezDevice.getName(BluezDevice.java:504) ~[?:?]
    at cz.organovabanka.bluetooth.manager.transport.dbus.BluezFactory.convert(BluezFactory.java:389) ~[?:?]
    at cz.organovabanka.bluetooth.manager.transport.dbus.BluezFactory.lambda$getDiscoveredDevices$8(BluezFactory.java:297) ~[?:?]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) [?:?]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) [?:?]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) [?:?]
    at java.util.concurrent.ConcurrentHashMap$ValueSpliterator.forEachRemaining(ConcurrentHashMap.java:3566) [?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) [?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) [?:?]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) [?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [?:?]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) [?:?]
    at cz.organovabanka.bluetooth.manager.transport.dbus.BluezFactory.getDiscoveredDevices(BluezFactory.java:298) [219:organovabanka.org.eclipse.smarthome.binding.bluetooth.transport.dbus:1.0.0.SNAPSHOT]
    at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$DeviceDiscoveryJob.discoverDevices(BluetoothManagerImpl.java:690) [214:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.5]
    at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$DeviceDiscoveryJob.run(BluetoothManagerImpl.java:683) [214:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.5]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]

I'm going to try your fix. I'll let you know.

vkolotov commented 6 years ago

Sorry, I was completely out of action with my sickness. I've been monitoring it with your fix and never saw that exception so far. I guess you've fixed it. Cheers.

However, there are a few other issues I faced. I'l be adding them shortly.

xrucka commented 6 years ago

This one is a lot more serious. It - at least in theory - should not occur unless either DBus or Bluez dies. Or perhaps, if there was different dbus-based extension closing the dbus connection (which, however, should not occur). How long were you waiting before restarting the openhab?

vkolotov commented 6 years ago

Hi @xrucka, are you referring #6 ? If so, I could not catch that moment when it starts doing so. I will keep monitoring it.

xrucka commented 6 years ago

Morning, @vkolotov yep, I somehow managed to reply into the wrong window and not notice it :-/

xrucka commented 6 years ago

(no reference in commit, just numbering :-/)