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

LwM2M: any retransmitted block #0 is forwarded to upper layer with no warning #71351

Closed
marco85mars20 opened this issue Apr 10, 2024 · 1 comment · Fixed by #72590
Closed
Assignees
Labels
area: LWM2M bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@marco85mars20
Copy link
Collaborator

marco85mars20 commented Apr 10, 2024

Describe the bug

Two issues:

  • when the post-write callback receives the payload of block #0, it often differs from the actual block size. This might not be a bug since block transfers can complete successfully, however, RCF 7959, section 2.3 specifies that:
    Update: as expected, this is not an issue; the first 5B of the block 0's payload are actually a TLV data struct providing information about the actual size of the data being transferred (feels a bit redundant, but it must have its reasons).
<s>The block size implied by SZX MUST match the size of the payload in bytes, if the M bit is set.
(SZX does not govern the payload size if M is unset).

Screenshot 2024-04-10 at 9 58 03 pm

Logs printed from the post-write callback:

  • The first 2 blocks have the same size (smaller than the actual block size), ie. the second one is a duplicate of Block 0
  • The last block reported as block 733 is, in fact, block 732, and it causes the total size received to exceed the size of the data transferred
/* block num is a counter incremented at every block received by my custom post-write callback */
[00:02:30.217,926] <dbg> lwm2m_dfu: firmware_block_received: received 1019 B, total: 1019/751444 B, last_block:0, block num: 0  (0%)
[00:02:30.219,970] <dbg> lwm2m_dfu: firmware_block_received: received 1019 B, total: 2038/751444 B, last_block:0, block num: 1  (0%)
[00:02:30.423,461] <dbg> lwm2m_dfu: firmware_block_received: received 1024 B, total: 3062/751444 B, last_block:0, block num: 2  (0%)
[00:02:30.619,415] <dbg> lwm2m_dfu: firmware_block_received: received 1024 B, total: 4086/751444 B, last_block:0, block num: 3  (0%)num: 4  (0%)

[..]

[00:04:55.706,665] <dbg> lwm2m_dfu: firmware_block_received: received 1024 B, total: 748534/751444 B, last_block:0, block num: 730  (99%)
[00:04:55.903,350] <dbg> lwm2m_dfu: firmware_block_received: received 1024 B, total: 749558/751444 B, last_block:0, block num: 731  (99%)
[00:04:56.117,889] <dbg> lwm2m_dfu: firmware_block_received: received 1024 B, total: 750582/751444 B, last_block:0, block num: 732  (99%)
[00:04:56.320,251] <inf> lwm2m_dfu: firmware_block_received: received 1024 B, total: 751606/751444 B, last_block:0, block num: 733  (100%)

Expected behavior
Since Tokens cannot be used to trace a block-wise transfer (#57165), it is not possible to detect if a Block #0 has already been processed, for this reason, I believe the only option is to pass the block-number to the post-write callback.
However, tokens could still be useful for detecting duplicates of block 0.

@marco85mars20 marco85mars20 added the bug The issue is a bug, or the PR is fixing a bug label Apr 10, 2024
@nordicjm
Copy link
Collaborator

This issue lacks required information such as what zephyr version you are using, can you fill in the required information from https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/main/.github/ISSUE_TEMPLATE/001_bug_report.md by updating the post?

@nashif nashif added the priority: medium Medium impact/importance bug label Apr 23, 2024
SeppoTakalo added a commit to SeppoTakalo/zephyr that referenced this issue May 10, 2024
When Block-Wise transfer restarts, the post-write callback should
receive some indication that the block is actually a beginning of new,
instead of part of previous transfer.

Fixes zephyrproject-rtos#71351

Signed-off-by: Seppo Takalo <[email protected]>
SeppoTakalo added a commit to SeppoTakalo/zephyr that referenced this issue May 13, 2024
When Block-Wise transfer restarts, the post-write callback should
receive some indication that the block is actually a beginning of new,
instead of part of previous transfer.

Fixes zephyrproject-rtos#71351

Signed-off-by: Seppo Takalo <[email protected]>
SeppoTakalo added a commit to SeppoTakalo/zephyr that referenced this issue May 14, 2024
When Block-Wise transfer restarts, the post-write callback should
receive some indication that the block is actually a beginning of new,
instead of part of previous transfer.

Fixes zephyrproject-rtos#71351

Signed-off-by: Seppo Takalo <[email protected]>
aescolar pushed a commit that referenced this issue May 15, 2024
When Block-Wise transfer restarts, the post-write callback should
receive some indication that the block is actually a beginning of new,
instead of part of previous transfer.

Fixes #71351

Signed-off-by: Seppo Takalo <[email protected]>
ycsin pushed a commit to ycsin/zephyr that referenced this issue May 17, 2024
When Block-Wise transfer restarts, the post-write callback should
receive some indication that the block is actually a beginning of new,
instead of part of previous transfer.

Fixes zephyrproject-rtos#71351

Signed-off-by: Seppo Takalo <[email protected]>
mariopaja pushed a commit to mariopaja/zephyr that referenced this issue May 26, 2024
When Block-Wise transfer restarts, the post-write callback should
receive some indication that the block is actually a beginning of new,
instead of part of previous transfer.

Fixes zephyrproject-rtos#71351

Signed-off-by: Seppo Takalo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: LWM2M bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants