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

Payload (250 bytes) too long for MTU: 249 #88

Closed
tonkarhu opened this issue Dec 5, 2022 · 9 comments · Fixed by #89
Closed

Payload (250 bytes) too long for MTU: 249 #88

tonkarhu opened this issue Dec 5, 2022 · 9 comments · Fixed by #89

Comments

@tonkarhu
Copy link

tonkarhu commented Dec 5, 2022

Problem I started to see today:

E/Uploader: Upload failed
    Payload (250 bytes) too long for MTU: 249
        at io.runtime.mcumgr.ble.McuMgrBleTransport.lambda$send$0$io-runtime-mcumgr-ble-McuMgrBleTransport(McuMgrBleTransport.java:356)
        at io.runtime.mcumgr.ble.McuMgrBleTransport$$ExternalSyntheticLambda3.onRequestCompleted(Unknown Source:13)
        at no.nordicsemi.android.ble.Request.lambda$notifySuccess$1$no-nordicsemi-android-ble-Request(Request.java:1239)
        at no.nordicsemi.android.ble.Request$$ExternalSyntheticLambda2.run(Unknown Source:4)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.os.HandlerThread.run(HandlerThread.java:67)

I solved this by downgrading
no.nordicsemi.android:mcumgr-ble:1.5.0
to
no.nordicsemi.android:mcumgr-ble:1.4.1'

in my app and it works now.

My guess is that the "Ble library update":
"BLE library updated to version 2.6.0-alpha04 by @philips77" in @#84
has to do something with this issue.

@philips77
Copy link
Member

philips77 commented Dec 6, 2022

The issue you're having is not related to BLE library.
The root cause seems to be this PR: #83

@philips77 philips77 transferred this issue from NordicSemiconductor/Android-BLE-Library Dec 6, 2022
@philips77
Copy link
Member

Could you say the offset at which you're getting this error? Is it at the beginning, or later during the upload?

@tonkarhu
Copy link
Author

tonkarhu commented Dec 7, 2022

Sometimes it fails after the first transfer sometimes after multiple transfers:

I/flutter: == Percentage: 16 % ==
I/System.out: == [1670399859403] bytes sent: 64496, image size: 388603 ==
I/flutter: == onUploadProgressChanged: {bytesSent: 64496, imageSize: 388603, timestamp: 1670399859403} ==
I/flutter: == Speed: 4.827731725697061 bytes/ms ==
I/flutter: == Time left: 67134.42635489511 ms ==
I/flutter: == Percentage: 17 % ==
I/System.out: == [1670399859505] bytes sent: 64944, image size: 388603 ==
I/flutter: == onUploadProgressChanged: {bytesSent: 64944, imageSize: 388603, timestamp: 1670399859505} ==
I/flutter: == Speed: 4.824409213281483 bytes/ms ==
I/flutter: == Time left: 67087.79991319445 ms ==
I/flutter: == Percentage: 17 % ==
W/System.err: Payload (251 bytes) too long for MTU: 249
W/System.err:     at io.runtime.mcumgr.ble.McuMgrBleTransport.lambda$send$0$McuMgrBleTransport(McuMgrBleTransport.java:356)
W/System.err:     at io.runtime.mcumgr.ble.-$$Lambda$McuMgrBleTransport$G9R9yrfNM-X8bvUSG0-6o8BwsHU.onRequestCompleted(Unknown Source:13)
W/System.err:     at no.nordicsemi.android.ble.Request.lambda$notifySuccess$1$Request(Request.java:1239)
W/System.err:     at no.nordicsemi.android.ble.-$$Lambda$Request$ep6TD_94xCe5LaEafH2PrarR3yc.run(Unknown Source:4)
W/System.err:     at android.os.Handler.handleCallback(Handler.java:938)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err:     at android.os.Looper.loopOnce(Looper.java:226)
W/System.err:     at android.os.Looper.loop(Looper.java:313)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:8751)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
I/System.out: == Upgrade failed: Payload (251 bytes) too long for MTU: 249 ==
I/flutter: == onUpgradeFailed: {state: UPLOAD, error: Payload (251 bytes) too long for MTU: 249

@philips77
Copy link
Member

What windowCapacity and memoryAlignment are you setting in the FirmwareUpgradeManager?

@tonkarhu
Copy link
Author

tonkarhu commented Dec 7, 2022

So far, I have only tested with WindowCapacity: 4 and memoryAlignment: 1

@philips77
Copy link
Member

Good news, I manage to replicate the issue!

philips77 added a commit that referenced this issue Dec 12, 2022
@philips77
Copy link
Member

I just released 1.5.2 with this issue fixed. Thank you for finding the bug!

@nrbrook
Copy link

nrbrook commented Aug 26, 2024

I have this issue after upgrading to 2.0.1. Is there something I'm missing?

@nrbrook
Copy link

nrbrook commented Aug 27, 2024

Fixed again in 2.0.2

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

Successfully merging a pull request may close this issue.

3 participants