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 crash caused by concurrent access to MQTT sink #40

Merged
merged 2 commits into from
Feb 20, 2024

Commits on Feb 16, 2024

  1. Fix crash caused by concurrent access to MQTT sink.

    Prior to this fix messages received through a Zenoh subscription were sent to the related MQTT sink directly from the Zenoh callback. Invoking the MQTT sink in this way leads to the ntex-mqtt implementations write cache being accessed from the calling thread. At the same time it is possible for the ntex-mqtt server worker thread to also access this write cache as part of its background tasks. As the write cache is designed to be accessed in a single threaded context only this lead to an abort.
    
    To fix this an MPSC channel is introduced allowing the Zenoh subscriber callbacks to send messages to an asynchronous task running within the ntex-mqtt server which then forwards the message to MQTT. This fix was inspired by this discussion: ntex-rs/ntex-mqtt#66
    gmartin82 committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    410f9ec View commit details
    Browse the repository at this point in the history
  2. Formatted code.

    gmartin82 committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    f729d46 View commit details
    Browse the repository at this point in the history