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

log_streaming: make it robust to message drops #2290

Merged
merged 1 commit into from
May 13, 2024

Conversation

julianoes
Copy link
Collaborator

When a message is dropped, we need to discard any message part. Otherwise, we end up having corrrupt ulog files.

When a message is dropped, we need to discard any message part.
Otherwise, we end up having corrrupt ulog files.

Signed-off-by: Julian Oes <julian@oes.ch>
Copy link

sonarcloud bot commented Apr 30, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@julianoes
Copy link
Collaborator Author

@bkueng would be great if you could check I got this right.

@julianoes
Copy link
Collaborator Author

I believe this is better than what's in main, so I'm merging it now before the next release.

@julianoes julianoes merged commit 8932698 into main May 13, 2024
28 checks passed
@julianoes julianoes deleted the pr-log-streaming-drops branch May 13, 2024 03:47
Comment on lines +305 to +308
_ulog_data.insert(
_ulog_data.end(),
logging_data_acked.data + logging_data_acked.first_message_offset,
logging_data_acked.data + logging_data_acked.length);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you must only insert if there's a valid offset: logging_data_acked.first_message_offset != std::numeric_limits<uint8_t>::max()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right!

switch (drop_state) {
case DropState::Ok:
if (logging_data_acked.first_message_offset == std::numeric_limits<uint8_t>::max()) {
_ulog_data.insert(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a dropout you must first wait for a valid logging_data_acked.first_message_offset before inserting in _ulog_data

Copy link
Collaborator Author

@julianoes julianoes May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. So I need to keep track of the previous state. Or rather set if there was a valid one.

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.

None yet

2 participants