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

unexpected failure in receive maximum test (test_flow_control2) #68

Open
DrmagicE opened this issue Aug 22, 2020 · 1 comment
Open

unexpected failure in receive maximum test (test_flow_control2) #68

DrmagicE opened this issue Aug 22, 2020 · 1 comment

Comments

@DrmagicE
Copy link

DrmagicE commented Aug 22, 2020

I use this repo to test my broker program.
I set server receive maximum = 2 and run test_flow_control2. The test fails with the following error:

E/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py:656: ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 52575)>
  outcome.errors.clear()
ResourceWarning: Enable tracemalloc to get the object allocation traceback

======================================================================

ERROR: test_flow_control2 (__main__.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "client_test5.py", line 1025, in test_flow_control2
    receiver.receive(testcallback)
  File "/usr/local/gopath/src/github.com/eclipse/paho.mqtt.testing/interoperability/mqtt/clients/V5/internal.py", line 85, in receive
    self.socket.send(self.pubrel.pack())
BrokenPipeError: [Errno 32] Broken pipe

----------------------------------------------------------------------
Ran 1 test in 0.024s

The packet flows:

C -connect--> S
C <-connack-- S // set receive maximum = 2 
C --publish-> S
C --publish-> S
C <-pubrec--- S
C <-pubrec--- S
C --publish-> S     // receive more than receive maximum (2)
C <-disconnect S  // so i send disconnect and close the connection. 
C -->pubrel--> S  // the connection has already closed and the test will fail

According to the spec, when receives more than receive maximum, the server should send disconnect and close the network.

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 Handling errors

I expect it should pass the test. Did i miss something?

@DrmagicE
Copy link
Author

wireshark capture:

Frame 141: 81 bytes on wire (648 bits), 81 bytes captured (648 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 53219, Dst Port: 1883, Seq: 1, Ack: 1, Len: 25
MQ Telemetry Transport Protocol, Connect Command
    Header Flags: 0x10, Message Type: Connect Command
    Msg Len: 23
    Protocol Name Length: 4
    Protocol Name: MQTT
    Version: MQTT v5.0 (5)
    Connect Flags: 0x02, QoS Level: At most once delivery (Fire and Forget), Clean Session Flag
    Keep Alive: 0
    Properties
        Total Length: 0
    Client ID Length: 10
    Client ID: myclientid


Frame 143: 82 bytes on wire (656 bits), 82 bytes captured (656 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 1883, Dst Port: 53219, Seq: 1, Ack: 26, Len: 26
MQ Telemetry Transport Protocol, Connect Ack
    Header Flags: 0x20, Message Type: Connect Ack
    Msg Len: 24
    Acknowledge Flags: 0x00
    Reason Code: Success (0)
    Properties
        Total Length: 21
        ID: Receive Maximum (0x21)
        Value: 2
        ID: Topic Alias Maximum (0x22)
        Value: 10
        ID: Maximum QoS (0x24)
        QoS: Exactly once delivery (Assured Delivery) (2)
        ID: Retain Available (0x25)
        Value: 1
        ID: Maximum Packet Size (0x27)
        Value: 200
        ID: Wildcard Subscription Available (0x28)
        Value: 1
        ID: Subscription Identifier Available (0x29)
        Value: 1
        ID: Shared Subscription Available (0x2a)
        Value: 1

Frame 145: 78 bytes on wire (624 bits), 78 bytes captured (624 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 53219, Dst Port: 1883, Seq: 26, Ack: 27, Len: 22
MQ Telemetry Transport Protocol, Publish Message
    Header Flags: 0x34, Message Type: Publish Message, QoS Level: Exactly once delivery (Assured Delivery)
    Msg Len: 20
    Topic Length: 6
    Topic: TopicA
    Message Identifier: 2
    Properties
        Total Length: 0
    Message: 6d6573736167652031


Frame 147: 78 bytes on wire (624 bits), 78 bytes captured (624 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 53219, Dst Port: 1883, Seq: 48, Ack: 27, Len: 22
MQ Telemetry Transport Protocol, Publish Message
    Header Flags: 0x34, Message Type: Publish Message, QoS Level: Exactly once delivery (Assured Delivery)
    Msg Len: 20
    Topic Length: 6
    Topic: TopicA
    Message Identifier: 3
    Properties
        Total Length: 0
    Message: 6d6573736167652032


Frame 149: 62 bytes on wire (496 bits), 62 bytes captured (496 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 1883, Dst Port: 53219, Seq: 27, Ack: 70, Len: 6
MQ Telemetry Transport Protocol, Publish Received
    Header Flags: 0x50, Message Type: Publish Received
    Msg Len: 4
    Message Identifier: 2
    Reason Code: No matching subscribers (16)
    Properties
        Total Length: 0


Frame 151: 62 bytes on wire (496 bits), 62 bytes captured (496 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 1883, Dst Port: 53219, Seq: 33, Ack: 70, Len: 6
MQ Telemetry Transport Protocol, Publish Received
    Header Flags: 0x50, Message Type: Publish Received
    Msg Len: 4
    Message Identifier: 3
    Reason Code: No matching subscribers (16)
    Properties
        Total Length: 0

Frame 152: 78 bytes on wire (624 bits), 78 bytes captured (624 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 53219, Dst Port: 1883, Seq: 70, Ack: 33, Len: 22
MQ Telemetry Transport Protocol, Publish Message
    Header Flags: 0x34, Message Type: Publish Message, QoS Level: Exactly once delivery (Assured Delivery)
    Msg Len: 20
    Topic Length: 6
    Topic: TopicA
    Message Identifier: 4
    Properties
        Total Length: 0
    Message: 6d6573736167652033

Frame 155: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 1883, Dst Port: 53219, Seq: 39, Ack: 92, Len: 4
MQ Telemetry Transport Protocol, Disconnect Req
    Header Flags: 0xe0, Message Type: Disconnect Req
    Msg Len: 2
    Reason Code: Receive Maximum exceeded (147)
    Properties
        Total Length: 0

Frame 159: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 53219, Dst Port: 1883, Seq: 92, Ack: 44, Len: 4
MQ Telemetry Transport Protocol, Publish Release
    Header Flags: 0x62, Message Type: Publish Release
    Msg Len: 2
    Message Identifier: 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant