Giter Club home page Giter Club logo

Comments (4)

zmstone avatar zmstone commented on May 23, 2024

Hi @calliday
It has been fixed in 5.6.0.
#12492

from emqx.

calliday avatar calliday commented on May 23, 2024

Ah, thank you! I will upgrade and test when I am able to.

from emqx.

calliday avatar calliday commented on May 23, 2024

After testing, I see that the Receive Maximum is being sent in the CONNACK.

However, I found that if the bridging broker (Mosquitto, in this case) sends more PUBLISH messages than the Receive Maximum established by EMQX, EMQX doesn't send a DISCONNECT packet to indicate that the Receive Maximum wasn't honored.

In my case, EMQX's Receive Maximum was set to 10 and Mosquitto's was set to 50. Mosquitto sends 50 in quick succession, and then after the first PUBACK is received it continues to send more PUBLISH messages. No DISCONNECT is sent by EMQX when this happens.

Mosquitto has a bug, where it doesn't honor the Receive Maximum, but it also appears that EMQX has a bug in that it doesn't tell the broker to disconnect when the Receive Maximum is not honored.

The messages logged by Mosquitto:

*** SEND 50 QUEUED PUBLISH MESSAGES ON STARTUP ***

1714078788: Sending PUBLISH to local.bridge (d1, q1, r0, m5733, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d1, q1, r0, m5734, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d1, q1, r0, m5735, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d1, q1, r0, m5736, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d1, q1, r0, m5737, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d1, q1, r0, m5738, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d1, q1, r0, m5739, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d1, q1, r0, m5740, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d1, q1, r0, m5741, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5742, 'bridge/test', ... (38 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5743, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5744, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5745, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5746, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5747, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5748, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5749, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5750, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5751, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5752, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5753, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5754, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5755, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5756, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5757, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5758, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5759, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5760, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5761, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5762, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5763, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5764, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5765, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5766, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5767, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5768, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5769, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5770, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5771, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5772, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5773, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5774, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5775, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5776, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5777, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5778, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5779, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5780, 'bridge/test', ... (40 bytes))
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5781, 'bridge/test', ... (40 bytes))
1714078788: Received UNSUBACK from local.bridge
1714078788: Received UNSUBACK from local.bridge
1714078788: Received UNSUBACK from local.bridge
1714078788: Received UNSUBACK from local.bridge
1714078788: Received UNSUBACK from local.bridge
1714078788: Received SUBACK from local.bridge

*** RECEIVE FIRST PUBACK AND SEND A PUBLISH ***

1714078788: Received PUBACK from local.bridge (Mid: 5732, RC:16)
1714078788: Sending PUBLISH to local.bridge (d0, q1, r0, m5782, 'bridge/test', ... (40 bytes)

*** NO DISCONNECT SEEN ***

from emqx.

zmstone avatar zmstone commented on May 23, 2024

I would not call it a bug.
All you can tell from the logs is mosquitto managed to put more than MAX number of messages on wire (more likely in the socket send buffer), there is no evidence to say that EMQX has actually received more than MAX number of messages pending on PUBACK back to the client.

For QoS 1 messages, EMQX just tries its best to process.

loop() ->
  wait_for_PUBLISH
  dispatch_to_subscribers
  send_PUBACK
  loop()

Even if the client is able to send more than negotiated MAX, the MAX-1 messages will be inflight:

  • in client side socket send buffer pending for send
  • in server side socket buffer pending for receive
  • in Erlang process (actor) receive queue (but still raw bytes, i.e. before decoded, which technically should not be counted as received)

For QoS 2 messages however, since it has to maintain a inflight state which has a size limit, you should be able to observe DISCONNECT with reason code 0x93.

from emqx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.