Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogManager response with invalid format #58

Open
bmoliveira opened this issue Oct 17, 2019 · 5 comments
Open

LogManager response with invalid format #58

bmoliveira opened this issue Oct 17, 2019 · 5 comments

Comments

@bmoliveira
Copy link

Hi,

I'm trying to get the logs from a device using the LogManager, and while trying to getAllFromState(State) or manager.getAll() I'm getting an exception on the parse of an entry on the response object.

The Object is McuMgrLogResponse.Entry and the property that I'm getting the error is msg because the format is in Byte[] and I'm receiving it as String.

Does this error has something to do with any Mynewt updates that are breaking the SDK?

Thank you

@bgiori
Copy link
Member

bgiori commented Oct 17, 2019

Hi, thanks for reporting the issue. I think there have been recent changes in mynewt for integrating mcumgr rather than using the old standard newtmgr.

I am not entirely sure what the issue is, but since both ios and android libraries' log collection is busted for seemingly the same reason, there must have been a change on the firmware side.

@bgiori
Copy link
Member

bgiori commented Oct 17, 2019

@bmoliveira

I'm getting an exception on the parse of an entry on the response object.

  1. Can you paste the stack trace?

  2. Would you be able to check the system config variable value for LOG_VERSION in your mynewt target?

The most recent log version (3) has had the msg field as a byte array while previous version have used a string. However, the log version has not changed in years, so maybe an update on the firmware side has caused this field to change.

I will continue to look into other possibilities.

This

@bmoliveira
Copy link
Author

  1. The error is in jackson when calling: manager.getAllFromState(LogManager.State("reboot_log")) or manager.getAll()

  2. When I have the LOG_VERSION I'll add it here.

Crash from

@Override
    public void onDataReceived(@NonNull BluetoothDevice device, @NonNull Data data) {
        try {
            T response = McuMgrResponse.buildResponse(McuMgrScheme.BLE, data.getValue(), responseType);
            onResponseReceived(device, response);
        } catch (final Exception e) {
            onInvalidDataReceived(device, data);
        }
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `byte[]` out of VALUE_STRING token
     at [Source: (byte[])"�jnext_index���dlogs��dnamejreboot_logdtype�gentries��cmsgxmrsn:SYSTEM_OFF_INT, cnt:1, img:0.0.8.6, hash:6859d66e619961c36ee371030bfc4f7b216e4a176d47f70e9c790e0f02f8e263bts����1(elevel�eindex�fmodule���cmsgxmrsn:SYSTEM_OFF_INT, cnt:1, img:0.0.8.6, hash:6859d66e619961c36ee371030bfc4f7b216e4a176d47f70e9c790e0f02f8e263bts����O�elevel�eindex���fmodule�����brc��"; line: -1, column: 58] (through reference chain: io.runtime.mcumgr.response.log.McuMgrLogResponse["logs"]->java.lang.Object[][0]->io.runtime.mcumgr.response.log.McuMgrLogResponse$LogResult["entries"]->java.lang.Object[][0]->io.runtime.mcumgr.response.log.McuMgrLogResponse$Entry["msg"])
     at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342)
     at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1138)
     at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1092)
     at com.fasterxml.jackson.databind.deser.std.PrimitiveArrayDeserializers.handleNonArray(PrimitiveArrayDeserializers.java:240)
     at com.fasterxml.jackson.databind.deser.std.PrimitiveArrayDeserializers$ByteDeser.deserialize(PrimitiveArrayDeserializers.java:498)
     at com.fasterxml.jackson.databind.deser.std.PrimitiveArrayDeserializers$ByteDeser.deserialize(PrimitiveArrayDeserializers.java:446)
     at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
     at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
     at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
     at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:195)
     at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:21)
     at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
     at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
     at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
     at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:195)
     at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:21)
     at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
     at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
     at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
     at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
     at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3091)
     at io.runtime.mcumgr.util.CBOR.toObject(CBOR.java:29)
     at io.runtime.mcumgr.response.McuMgrResponse.buildResponse(McuMgrResponse.java:229)
     at io.runtime.mcumgr.ble.callback.SmpDataCallback.onDataReceived(SmpDataCallback.java:28)
     at io.runtime.mcumgr.ble.callback.SmpResponse.onDataReceived(SmpResponse.java:29)
     at no.nordicsemi.android.ble.WaitForValueChangedRequest.notifyValueChanged(WaitForValueChangedRequest.java:358)
     at no.nordicsemi.android.ble.BleManager$BleManagerGattCallback.onCharacteristicChangedSafe(BleManager.java:2856)
     at no.nordicsemi.android.ble.MainThreadBluetoothGattCallback.lambda$onCharacteristicChanged$4$MainThreadBluetoothGattCallback(MainThreadBluetoothGattCallback.java:135)
     at no.nordicsemi.android.ble.-$$Lambda$MainThreadBluetoothGattCallback$7AU42XLOqZKSRIMVuifw3eecBbw.run(Unknown Source:8)
     at android.os.Handler.handleCallback(Handler.java:883)
     at android.os.Handler.dispatchMessage(Handler.java:100)
     at android.os.Looper.loop(Looper.java:214)
     at android.app.ActivityThread.main(ActivityThread.java:7356)
     at java.lang.reflect.Method.invoke(Native Method)
     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

@bmoliveira
Copy link
Author

Hey,

Regarding the LOG_VERSION we are using the V2

@bgiori
Copy link
Member

bgiori commented Oct 22, 2019

That is the issue. Not sure how it worked before (if it did) but V2 has been deprecated for V3 which uses a byte[] for the msg rather than a string. I would ask your firmware guys to change that sysconfig to 3 and things should work properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants