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

fix: increase max packet size for built-in bridge #3059

Merged
merged 4 commits into from
Aug 13, 2024

Conversation

jarhodes314
Copy link
Contributor

@jarhodes314 jarhodes314 commented Aug 8, 2024

Proposed changes

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@jarhodes314 jarhodes314 temporarily deployed to Test Pull Request August 8, 2024 18:02 — with GitHub Actions Inactive
@jarhodes314 jarhodes314 added the theme:mqtt Theme: mqtt and mosquitto related topics label Aug 8, 2024
Copy link

codecov bot commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.7%. Comparing base (79fb63c) to head (5cfb663).
Report is 6 commits behind head on main.

Files Patch % Lines
crates/extensions/tedge_mqtt_bridge/src/lib.rs 87.5% 0 Missing and 1 partial ⚠️
Additional details and impacted files
Files Coverage Δ
.../tedge_config/src/tedge_config_cli/tedge_config.rs 73.7% <100.0%> (+<0.1%) ⬆️
crates/extensions/tedge_mqtt_bridge/src/lib.rs 89.3% <87.5%> (+1.0%) ⬆️

... and 4 files with indirect coverage changes

Copy link
Contributor

github-actions bot commented Aug 8, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
491 0 2 491 100 1h33m30.187594999s

@@ -57,6 +57,8 @@ use crate::topics::matches_ignore_dollar_prefix;
use crate::topics::TopicConverter;
pub use config::*;

const MAX_PACKET_SIZE: usize = 10 * 1024 * 1024;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we have some inconsistency with packet sizes used across the project.

  1. In mqtt_channel::config::Config: 1024 * 1024
  2. In bridge::common_mosquitto_config::CommonMosquittoConfig: 256 * 1024 * 1024 - 1
  3. In tedge::cli::mqtt::MAX_PACKET_SIZE: 10 * 1024 * 1024

Any reason why you chose the 3rd option and not the second one, keeping it consistent with the existing bridge config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't realise that mosquitto used a completely different name for the configuration, so didn't notice it. I'll change this to be consistent with the existing bridge.

Comment on lines +389 to +393
if pkid != 0 {
// Messages with pkid 0 (meaning QoS=0) should not be added to the hashmap
// as multiple messages with the pkid=0 can be received
e.insert(msg);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this pkid = 0 case be covered with a unit test?

Copy link
Contributor Author

@jarhodes314 jarhodes314 Aug 9, 2024

Choose a reason for hiding this comment

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

Not easily. In an ideal world, we would have some deterministic tests where we control the broker we connect to directly, so we can send QoS 0 messages. This would also shore up the existing integration tests, which have to flood the bridge with thousands of messages before disconnecting to reproduce the desired behaviour.

I think this might be worth investigating in a time-boxed manner, but I'll create a separate ticket for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can this pkid = 0 case be covered with a unit test?

This is tested by the system test "Support publishing QoS 0 messages to c8y topic #2960".

Sure, this test is not deterministic (as messages with QoS 0 might not be delivered), but I think that is enough.

albinsuresh
albinsuresh previously approved these changes Aug 12, 2024
Copy link
Contributor

@albinsuresh albinsuresh left a comment

Choose a reason for hiding this comment

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

LGTM

@albinsuresh albinsuresh dismissed their stale review August 13, 2024 05:49

The limit was expected to be 256 MiB

Copy link
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Approved

@jarhodes314 jarhodes314 added this pull request to the merge queue Aug 13, 2024
Merged via the queue into thin-edge:main with commit 57e5b42 Aug 13, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:mqtt Theme: mqtt and mosquitto related topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants