Skip to content

fix(logging): prevent dropped frames in multi-device logs - #420

Merged
frankie-zeng merged 1 commit into
ecubus:masterfrom
crazy0104:fix/issue-417-log-loss
Aug 12, 2026
Merged

fix(logging): prevent dropped frames in multi-device logs#420
frankie-zeng merged 1 commit into
ecubus:masterfrom
crazy0104:fix/issue-417-log-loss

Conversation

@crazy0104

@crazy0104 crazy0104 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • share one file transport across all selected devices instead of opening the same log file once per device
  • route device messages into the shared writer while preserving channel filtering and close it only once
  • keep BLF objects intact at container boundaries and serialize compression writes
  • use the expected BLF padding convention in the reader and add multi-device regression coverage

Root cause

Each device logger invoked the file transport factory independently. With multiple CAN channels selected, this created multiple writers for the same ASC/BLF path. Since each writer opened the file for writing, they could truncate or overwrite one another, even though the per-device statistics remained correct.

BLF logging also sliced the uncompressed buffer at the container limit without respecting object boundaries, and compression jobs could finish out of order. The BLF reader additionally used an incompatible padding calculation, which could stop parsing at a container boundary.

Validation

  • npx vitest --config vitest.config.ts run test/transport/deviceLog.test.ts test/replay/replay.spec.ts — 12 tests passed
  • npm run typecheck
  • generated a 5,000-frame, two-channel BLF and read all frames with python-can
  • replayed the recorded BLF and confirmed both channels retained the complete 5,000-frame payload sequence

Fixes #417

- route selected devices through a single file transport
- serialize BLF containers and keep objects intact
- match Vector padding and add multi-device regression coverage
@crazy0104
crazy0104 marked this pull request as ready for review August 1, 2026 18:30
@frankie-zeng
frankie-zeng merged commit f864d03 into ecubus:master Aug 12, 2026
2 checks passed
@lmg0521

lmg0521 commented Aug 21, 2026

Copy link
Copy Markdown

请问上面的修复也能解决单通道记录的log丢帧的问题吗?我尝试使用一个通道记录数据,也会存在recv cnt和发送端一致,但是log中丢帧的情况

@crazy0104

Copy link
Copy Markdown
Contributor Author

请问上面的修复也能解决单通道记录的log丢帧的问题吗?我尝试使用一个通道记录数据,也会存在recv cnt和发送端一致,但是log中丢帧的情况

这个PR优化了下多通道Log的相关实现,单通道应该也有改善,使用过程还是有问题可以单独提一个issue.。

@crazy0104
crazy0104 deleted the fix/issue-417-log-loss branch August 21, 2026 06:10
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 this pull request may close these issues.

[BUG]recvcnt和发送报文数量一致,但asc/blf数据内记录的数据有缺失

3 participants