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

[Bug] ntex-mqtt server unable to manage connections under high load #41

Open
gmartin82 opened this issue Feb 20, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@gmartin82
Copy link
Contributor

gmartin82 commented Feb 20, 2024

Describe the bug

The changes made for #39 introduced a secondary issue whereby the ntex-mqtt server struggles to manage MQTT connections when messages are being forwarded from Zenoh to MQTT clients at a high frequency.

Specifically, the server can't establish new connections with MQTT clients and can't maintain existing connections to clients due to failure to handle keep-alive messages. However, data is successfully forwarded from Zenoh to connected MQTT clients until the point where these connections time out.

This problem was known during the review of #39 and it was decided that the fix could be accepted with this issue as a known issue. Under common use cases of the MQTT plugin, it isn't expected to be an issue.

To reproduce

  1. Run the Zenoh router using the attached config.
  2. Setup and run a Mosquitto MQTT server with the following config:
$ cat /etc/mosquitto/conf.d/mosquitto-bridge-zenoh.conf
# Allow anonymous connections from `mosquitto_sub` clients
allow_anonymous true

# Redirect logs to be available via: `journalctl -u mosquitto -f`
log_dest stdout

listener 1883 localhost

connection mosquitto_zenoh_bridge

# zenoh-plugin-mqtt is listening on port 1884
address localhost:1884
topic # both 0

# zenoh-plugin-mqtt does not support... whatever this option does
try_private false

# Remap mosquitto broker status information from default of:
# $SYS/broker/connection/<remote_clientid>/state which is not a valid 
# zenoh key
notification_topic mqtt/broker/connection/mosquitto_zenoh_bridge/state
  1. Run the following client app:
#!/bin/env python3

import time
import json
import logging
import argparse
import zenoh

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('-v', '--verbose', action='count', default=0)
    args = parser.parse_args()
    logging.basicConfig(level=logging.WARNING - (10 * args.verbose))

    try:
        session = zenoh.open()
        pub = session.declare_publisher('foo/bar')

        while True:
            pub.put(json.dumps('simple message'))

    # zenoh.ZError is not accessible?
    except Exception:
        logging.exception('Waiting for router connection:')
  1. Observe that new MQTT clients are unable to connect and existing clients (e.g. the mosquito broker) disconnect after a few minutes.

System info

Platform: Ubuntu 20.04 64bit

@gmartin82 gmartin82 added the bug Something isn't working label Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant