eclipse/paho.mqtt.testing

client_test5.py test_flow_control2 possibly incorrect behaviour

mochi-co opened this issue · 1 comments

Hi @icraggs - firstly, thank you so much for all the work you have put into this test suite. It's an incredible tool for ensuring compliance.

I have a question regarding the behaviour of client_test5.py test_flow_control2.

In the MQTTv5 Specification (my emphasis):

  • "The Client MUST NOT send more than Receive Maximum QoS 1 and QoS 2 PUBLISH packets for which it has not received PUBACK, PUBCOMP, or PUBREC with a Reason Code of 128 or greater from the Server [MQTT-3.3.4-7]. If it receives more than Receive Maximum QoS 1 and QoS 2 PUBLISH packets where it has not sent a PUBACK or PUBCOMP in response, the Server uses a DISCONNECT packet with Reason Code 0x93 (Receive Maximum exceeded) as described in [section 4.13]", and,
  • "3.14.4 DISCONNECT Actions
    After sending a DISCONNECT packet the sender:
    MUST NOT send any more MQTT Control Packets on that Network Connection [MQTT-3.14.4-1].
    MUST close the Network Connection [MQTT-3.14.4-2]."

However, test_flow_control2 relies on the completion of the qos 2 flow in order to be successful prior to disconnect, and will fail with the following error if the server adheres to the above, ceasing to send any more packets immediately following the issuance of a disconnect:

E/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/unittest/case.py:621: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 55249)>
  outcome.errors.clear()
ResourceWarning: Enable tracemalloc to get the object allocation traceback

======================================================================
ERROR: test_flow_control2 (__main__.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mochi/Projects/Development/mochi-co/paho.mqtt.testing-master/interoperability/client_test5.py", line 1020, in test_flow_control2
    receiver.receive(testcallback)
  File "/Users/mochi/Projects/Development/mochi-co/paho.mqtt.testing-master/interoperability/mqtt/clients/V5/internal.py", line 86, in receive
    self.socket.send(self.pubrel.pack())
BrokenPipeError: [Errno 32] Broken pipe

In my understanding, the test should pass if the server ceases reading packets and immediately closes the connection once the disconnect has been successfully sent.

I look forward to your thoughts and any clarifications you might have.
Thanks again

Duplicate/Related of #68