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: built-in MQTT bridge handling of QoS 0 messages published to the cloud topic #3028

Merged
merged 3 commits into from
Jul 31, 2024

Conversation

reubenmiller
Copy link
Contributor

@reubenmiller reubenmiller commented Jul 31, 2024

Proposed changes

Messages with packet id 0 should be handled differently as they won't receive a PubAck or PubRec control messages hence it will never be removed from the hashmap and future messages with packet id 0 are ignored.

This should resolve the last incident seen on the OSADL slot 2 device, as the tedge mapper went unresponsive after requesting a file from the device, which most likely invoked a JWT request, which never was answered. Note, that the problem is limited to publishing messages directly to the cloud topic with QoS 0, as publishing a message to the te/# topics will be republished to the c8y/# topics with QoS > 0 (something automatically done by the bridge, to ensure reliable cloud communication).

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

Messages with packet id 0 should be handled
differently as they won't receive a PubAck or
PubRec control messages hence it will never
be removed from the hashmap and future
messages with packet id 0 are ignored

Signed-off-by: Reuben Miller <[email protected]>
@reubenmiller reubenmiller force-pushed the fix-builtin-bridge-qos-0 branch from bcc2c9e to fcaafac Compare July 31, 2024 08:12
@reubenmiller reubenmiller temporarily deployed to Test Pull Request July 31, 2024 08:12 — with GitHub Actions Inactive
@reubenmiller reubenmiller added the theme:mqtt Theme: mqtt and mosquitto related topics label Jul 31, 2024
@reubenmiller reubenmiller marked this pull request as ready for review July 31, 2024 08:16
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 78.0%. Comparing base (e419058) to head (bf9ed50).
Report is 54 commits behind head on main.

Files Patch % Lines
crates/extensions/tedge_mqtt_bridge/src/lib.rs 25.0% 6 Missing ⚠️
Additional details and impacted files
Files Coverage Δ
crates/extensions/tedge_mqtt_bridge/src/lib.rs 88.0% <25.0%> (-1.5%) ⬇️

... and 46 files with indirect coverage changes

@reubenmiller reubenmiller changed the title fix: built-in MQTT bridge handling of qos 0 messsages fix: built-in MQTT bridge handling of QoS 0 messages Jul 31, 2024
Copy link
Contributor

github-actions bot commented Jul 31, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
488 0 2 488 100 1h28m51.960845s

Copy link
Contributor

@gligorisaev gligorisaev left a comment

Choose a reason for hiding this comment

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

The added test was reviewed and it is passing

@reubenmiller reubenmiller temporarily deployed to Test Pull Request July 31, 2024 13:29 — with GitHub Actions Inactive
@reubenmiller reubenmiller changed the title fix: built-in MQTT bridge handling of QoS 0 messages fix: built-in MQTT bridge handling of QoS 0 messages published to the c8y topic Jul 31, 2024
@reubenmiller reubenmiller changed the title fix: built-in MQTT bridge handling of QoS 0 messages published to the c8y topic fix: built-in MQTT bridge handling of QoS 0 messages published to the cloud topic Jul 31, 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. At least the change that skips caching of QoS 0 messages.

@reubenmiller reubenmiller added this pull request to the merge queue Jul 31, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 31, 2024
@reubenmiller reubenmiller added this pull request to the merge queue Jul 31, 2024
Merged via the queue into thin-edge:main with commit 796e3e3 Jul 31, 2024
33 checks passed
@reubenmiller reubenmiller deleted the fix-builtin-bridge-qos-0 branch August 1, 2024 14:01
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