Giter Club home page Giter Club logo

Comments (33)

michaelklishin avatar michaelklishin commented on July 25, 2024

Are the messages actually routed? Consumers don't care about what order you start the scripts. But if something prevents messages from being routed, there will be nothing to consume. What does the management UI display?

from bunny.

celldee avatar celldee commented on July 25, 2024

There are messages in the queue and the consumer seems to be registered correctly. The consumer just blocks but doesn't consume any messages. The first message remains in the queue as unacknowledged.

It looks like this is what's happening -

  1. Messages are published to the queue.
  2. Consumer is started and receives consume-ok plus delivery frameset.
  3. Bunny treats server message as if it was just consume-ok, so does not process the delivery frameset.
  4. First message remains unacknowledged in queue and server does not send any more messages because prefetch is set.

I tried a version of the consumer that did not set prefetch and had ack => false. This consumed the messages but gave me no output. This is because a similar thing is happening to the sequence of events above -

  1. Messages are published to the queue.
  2. Consumer is started and receives consume-ok plus several delivery framesets.
  3. Bunny treats server message as if it was just consume-ok, so does not process the delivery framesets.
  4. Acknowledgements are not expected and queued messages were small enough to be sent to the server in one go with the consume-ok. Therefore all messages were consumed without being processed.

I confirmed the above by using Wireshark to analyse network traffic.

I also tried pretty much the same thing with Pika (using the RabbitMQ tutorial python code - http://www.rabbitmq.com/tutorials/tutorial-two-python.html) and it worked as expected. I started the consumer or the producer first and it works either way.

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

It works for me regardless of the order. I will add a couple of tests.

from bunny.

celldee avatar celldee commented on July 25, 2024

I am using RabbitMQ 3.0.1. Could that be making a difference?

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

I tried with 3.0.0, going to upgrade and try again. Adding a couple of tests is a good idea either way.

from bunny.

celldee avatar celldee commented on July 25, 2024

I re-installed RabbitMQ 3.0.0 and still got the same results. Strange that I'm the only one seeing this, but I don't think that my setup is broken.

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

I can reproduce it with a test now and only with 3.0.1 (not 3.0.0 or 2.8.7).

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

Actually, it is not version-specific. I had to bump waiting period in the test. Going to push it shortly.

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

Wireshark capture of the 2nd spec (with an empty queue), RabbitMQ 3.0.1:

λ ~/ tshark -i lo0 -O amqp -R amqp
Capturing on lo0
Frame 9: 391 bytes on wire (3128 bits), 391 bytes captured (3128 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 1, Ack: 9, Len: 335
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 327
    Class: Connection (10)
    Method: Start (10)
    Arguments
        Version-Major: 0
        Version-Minor: 9
        Server-Properties
            capabilities (field table): ...
            copyright (string): Copyright (C) 2007-2012 VMware, Inc.
            information (string): Licensed under the MPL.  See http://www.rabbitmq.com/
            platform (string): Erlang/OTP
            product (string): RabbitMQ
            version (string): 3.0.1
        Mechanisms: 504c41494e20414d51504c41494e
        Locales: 656e5f5553

Frame 11: 367 bytes on wire (2936 bits), 367 bytes captured (2936 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 9, Ack: 336, Len: 311
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 303
    Class: Connection (10)
    Method: Start-Ok (11)
    Arguments
        Client-Properties
            capabilities (field table): ...
            product (string): Bunny
            platform (string): ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin12.2.0]
            version (string): 0.9.0.pre4
            information (string): http://github.com/ruby-amqp/bunny
        Mechanism: PLAIN
        Response: 0062756e6e795f67656d0062756e6e795f70617373776f72...
        Locale: en_GB

Frame 13: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 336, Ack: 320, Len: 20
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 12
    Class: Connection (10)
    Method: Tune (30)
    Arguments
        Channel-Max: 0
        Frame-Max: 131072
        Heartbeat: 600

Frame 15: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 320, Ack: 356, Len: 20
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 12
    Class: Connection (10)
    Method: Tune-Ok (31)
    Arguments
        Channel-Max: 0
        Frame-Max: 131072
        Heartbeat: 600

Frame 17: 84 bytes on wire (672 bits), 84 bytes captured (672 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 340, Ack: 356, Len: 28
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 20
    Class: Connection (10)
    Method: Open (40)
    Arguments
        Virtual-Host: bunny_testbed
        Capabilities: 
        .... ...0 = Insist: False

Frame 19: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 356, Ack: 368, Len: 13
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 5
    Class: Connection (10)
    Method: Open-Ok (41)
    Arguments
        Known-Hosts: 

Frame 21: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 368, Ack: 369, Len: 13
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 5
    Class: Channel (20)
    Method: Open (10)
    Arguments
        Out-Of-Band: 

Frame 23: 72 bytes on wire (576 bits), 72 bytes captured (576 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 369, Ack: 381, Len: 16
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 8
    Class: Channel (20)
    Method: Open-Ok (11)
    Arguments
        Channel-Id: <MISSING>

Frame 25: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 381, Ack: 385, Len: 13
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 5
    Class: Channel (20)
    Method: Open (10)
    Arguments
        Out-Of-Band: 

Frame 27: 72 bytes on wire (576 bits), 72 bytes captured (576 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 385, Ack: 394, Len: 16
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 8
    Class: Channel (20)
    Method: Open-Ok (11)
    Arguments
        Channel-Id: <MISSING>

Frame 29: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 394, Ack: 401, Len: 13
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 3
    Length: 5
    Class: Channel (20)
    Method: Open (10)
    Arguments
        Out-Of-Band: 

Frame 31: 72 bytes on wire (576 bits), 72 bytes captured (576 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 401, Ack: 407, Len: 16
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 3
    Length: 8
    Class: Channel (20)
    Method: Open-Ok (11)
    Arguments
        Channel-Id: <MISSING>

Frame 33: 99 bytes on wire (792 bits), 99 bytes captured (792 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 407, Ack: 417, Len: 43
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 35
    Class: Queue (50)
    Method: Declare (10)
    Arguments
        Ticket: 0
        Queue: queue0.9149735982525051
        .... ...0 = Passive: False
        .... ..0. = Durable: False
        .... .1.. = Exclusive: True
        .... 0... = Auto-Delete: False
        ...0 .... = Nowait: False
        Arguments

Frame 35: 100 bytes on wire (800 bits), 100 bytes captured (800 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 417, Ack: 450, Len: 44
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 36
    Class: Queue (50)
    Method: Declare-Ok (11)
    Arguments
        Queue: queue0.9149735982525051
        Message-Count: 0
        Consumer-Count: 0

Frame 37: 96 bytes on wire (768 bits), 96 bytes captured (768 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 450, Ack: 461, Len: 40
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 3
    Length: 32
    Class: Basic (60)
    Method: Publish (40)
    Arguments
        Ticket: 0
        Exchange: 
        Routing-Key: queue0.9149735982525051
        .... ...0 = Mandatory: False
        .... ..0. = Immediate: False

Frame 39: 105 bytes on wire (840 bits), 105 bytes captured (840 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 490, Ack: 461, Len: 49
Advanced Message Queueing Protocol
    Type: Content header (2)
    Channel: 3
    Length: 41
    Class ID: Basic (60)
    Weight: 0
    Body size: 5
    Property flags: 0x9800
    Properties
        Content-Type: application/octet-stream
        Delivery-Mode: 2
        Priority: 0

Frame 41: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 539, Ack: 461, Len: 13
Advanced Message Queueing Protocol
    Type: Content body (3)
    Channel: 3
    Length: 5
    Payload: 6461746130

Frame 43: 96 bytes on wire (768 bits), 96 bytes captured (768 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 552, Ack: 461, Len: 40
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 3
    Length: 32
    Class: Basic (60)
    Method: Publish (40)
    Arguments
        Ticket: 0
        Exchange: 
        Routing-Key: queue0.9149735982525051
        .... ...0 = Mandatory: False
        .... ..0. = Immediate: False

Frame 45: 105 bytes on wire (840 bits), 105 bytes captured (840 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 592, Ack: 461, Len: 49
Advanced Message Queueing Protocol
    Type: Content header (2)
    Channel: 3
    Length: 41
    Class ID: Basic (60)
    Weight: 0
    Body size: 5
    Property flags: 0x9800
    Properties
        Content-Type: application/octet-stream
        Delivery-Mode: 2
        Priority: 0

Frame 47: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 641, Ack: 461, Len: 13
Advanced Message Queueing Protocol
    Type: Content body (3)
    Channel: 3
    Length: 5
    Payload: 6461746131

Frame 49: 96 bytes on wire (768 bits), 96 bytes captured (768 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 654, Ack: 461, Len: 40
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 3
    Length: 32
    Class: Basic (60)
    Method: Publish (40)
    Arguments
        Ticket: 0
        Exchange: 
        Routing-Key: queue0.9149735982525051
        .... ...0 = Mandatory: False
        .... ..0. = Immediate: False

Frame 51: 105 bytes on wire (840 bits), 105 bytes captured (840 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 694, Ack: 461, Len: 49
Advanced Message Queueing Protocol
    Type: Content header (2)
    Channel: 3
    Length: 41
    Class ID: Basic (60)
    Weight: 0
    Body size: 5
    Property flags: 0x9800
    Properties
        Content-Type: application/octet-stream
        Delivery-Mode: 2
        Priority: 0

Frame 53: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 743, Ack: 461, Len: 13
Advanced Message Queueing Protocol
    Type: Content body (3)
    Channel: 3
    Length: 5
    Payload: 6461746132

Frame 55: 99 bytes on wire (792 bits), 99 bytes captured (792 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 756, Ack: 461, Len: 43
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 35
    Class: Queue (50)
    Method: Declare (10)
    Arguments
        Ticket: 0
        Queue: queue0.9149735982525051
        .... ...1 = Passive: True
        .... ..0. = Durable: False
        .... .1.. = Exclusive: True
        .... 0... = Auto-Delete: False
        ...0 .... = Nowait: False
        Arguments

Frame 57: 100 bytes on wire (800 bits), 100 bytes captured (800 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 461, Ack: 799, Len: 44
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 36
    Class: Queue (50)
    Method: Declare-Ok (11)
    Arguments
        Queue: queue0.9149735982525051
        Message-Count: 3
        Consumer-Count: 0

Frame 59: 100 bytes on wire (800 bits), 100 bytes captured (800 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 799, Ack: 505, Len: 44
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 36
    Class: Basic (60)
    Method: Consume (20)
    Arguments
        Ticket: 0
        Queue: queue0.9149735982525051
        Consumer-Tag: 
        .... ...0 = No-Local: False
        .... ..0. = No-Ack: False
        .... .0.. = Exclusive: False
        .... 0... = Nowait: False
        Filter

Frame 61: 100 bytes on wire (800 bits), 100 bytes captured (800 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 505, Ack: 843, Len: 44
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 36
    Class: Basic (60)
    Method: Consume-Ok (21)
    Arguments
        Consumer-Tag: amq.ctag-AQCu7TLzN9g9D4nNDCoO-g

Frame 63: 476 bytes on wire (3808 bits), 476 bytes captured (3808 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 549, Ack: 843, Len: 420
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 70
    Class: Basic (60)
    Method: Deliver (60)
    Arguments
        Consumer-Tag: amq.ctag-AQCu7TLzN9g9D4nNDCoO-g
        Delivery-Tag: 1
        .... ...0 = Redelivered: False
        Exchange: 
        Routing-Key: queue0.9149735982525051
Advanced Message Queueing Protocol
    Type: Content header (2)
    Channel: 2
    Length: 41
    Class ID: Basic (60)
    Weight: 0
    Body size: 5
    Property flags: 0x9800
    Properties
        Content-Type: application/octet-stream
        Delivery-Mode: 2
        Priority: 0
Advanced Message Queueing Protocol
    Type: Content body (3)
    Channel: 2
    Length: 5
    Payload: 6461746130
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 70
    Class: Basic (60)
    Method: Deliver (60)
    Arguments
        Consumer-Tag: amq.ctag-AQCu7TLzN9g9D4nNDCoO-g
        Delivery-Tag: 2
        .... ...0 = Redelivered: False
        Exchange: 
        Routing-Key: queue0.9149735982525051
Advanced Message Queueing Protocol
    Type: Content header (2)
    Channel: 2
    Length: 41
    Class ID: Basic (60)
    Weight: 0
    Body size: 5
    Property flags: 0x9800
    Properties
        Content-Type: application/octet-stream
        Delivery-Mode: 2
        Priority: 0
Advanced Message Queueing Protocol
    Type: Content body (3)
    Channel: 2
    Length: 5
    Payload: 6461746131
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 70
    Class: Basic (60)
    Method: Deliver (60)
    Arguments
        Consumer-Tag: amq.ctag-AQCu7TLzN9g9D4nNDCoO-g
        Delivery-Tag: 3
        .... ...0 = Redelivered: False
        Exchange: 
        Routing-Key: queue0.9149735982525051
Advanced Message Queueing Protocol
    Type: Content header (2)
    Channel: 2
    Length: 41
    Class ID: Basic (60)
    Weight: 0
    Body size: 5
    Property flags: 0x9800
    Properties
        Content-Type: application/octet-stream
        Delivery-Mode: 2
        Priority: 0
Advanced Message Queueing Protocol
    Type: Content body (3)
    Channel: 2
    Length: 5
    Payload: 6461746132

Frame 77: 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 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 843, Ack: 969, Len: 26
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 18
    Class: Channel (20)
    Method: Close (40)
    Arguments
        Reply-Code: 200
        Reply-Text: Goodbye
        Class-Id: 0
        Method-Id: 0

Frame 79: 68 bytes on wire (544 bits), 68 bytes captured (544 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 969, Ack: 869, Len: 12
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 2
    Length: 4
    Class: Channel (20)
    Method: Close-Ok (41)
    Arguments

Frame 81: 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 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55945 (55945), Dst Port: amqp (5672), Seq: 869, Ack: 981, Len: 26
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 3
    Length: 18
    Class: Channel (20)
    Method: Close (40)
    Arguments
        Reply-Code: 200
        Reply-Text: Goodbye
        Class-Id: 0
        Method-Id: 0

Frame 83: 68 bytes on wire (544 bits), 68 bytes captured (544 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55945 (55945), Seq: 981, Ack: 895, Len: 12
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 3
    Length: 4
    Class: Channel (20)
    Method: Close-Ok (41)
    Arguments

Frame 91: 391 bytes on wire (3128 bits), 391 bytes captured (3128 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55946 (55946), Seq: 1, Ack: 9, Len: 335
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 327
    Class: Connection (10)
    Method: Start (10)
    Arguments
        Version-Major: 0
        Version-Minor: 9
        Server-Properties
            capabilities (field table): ...
            copyright (string): Copyright (C) 2007-2012 VMware, Inc.
            information (string): Licensed under the MPL.  See http://www.rabbitmq.com/
            platform (string): Erlang/OTP
            product (string): RabbitMQ
            version (string): 3.0.1
        Mechanisms: 504c41494e20414d51504c41494e
        Locales: 656e5f5553

Frame 93: 367 bytes on wire (2936 bits), 367 bytes captured (2936 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55946 (55946), Dst Port: amqp (5672), Seq: 9, Ack: 336, Len: 311
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 303
    Class: Connection (10)
    Method: Start-Ok (11)
    Arguments
        Client-Properties
            capabilities (field table): ...
            product (string): Bunny
            platform (string): ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin12.2.0]
            version (string): 0.9.0.pre4
            information (string): http://github.com/ruby-amqp/bunny
        Mechanism: PLAIN
        Response: 0062756e6e795f67656d0062756e6e795f70617373776f72...
        Locale: en_GB

Frame 95: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55946 (55946), Seq: 336, Ack: 320, Len: 20
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 12
    Class: Connection (10)
    Method: Tune (30)
    Arguments
        Channel-Max: 0
        Frame-Max: 131072
        Heartbeat: 600

Frame 97: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55946 (55946), Dst Port: amqp (5672), Seq: 320, Ack: 356, Len: 20
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 12
    Class: Connection (10)
    Method: Tune-Ok (31)
    Arguments
        Channel-Max: 0
        Frame-Max: 131072
        Heartbeat: 600

Frame 99: 84 bytes on wire (672 bits), 84 bytes captured (672 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55946 (55946), Dst Port: amqp (5672), Seq: 340, Ack: 356, Len: 28
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 20
    Class: Connection (10)
    Method: Open (40)
    Arguments
        Virtual-Host: bunny_testbed
        Capabilities: 
        .... ...0 = Insist: False

Frame 101: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55946 (55946), Seq: 356, Ack: 368, Len: 13
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 5
    Class: Connection (10)
    Method: Open-Ok (41)
    Arguments
        Known-Hosts: 

Frame 103: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55946 (55946), Dst Port: amqp (5672), Seq: 368, Ack: 369, Len: 13
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 5
    Class: Channel (20)
    Method: Open (10)
    Arguments
        Out-Of-Band: 

Frame 105: 72 bytes on wire (576 bits), 72 bytes captured (576 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55946 (55946), Seq: 369, Ack: 381, Len: 16
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 8
    Class: Channel (20)
    Method: Open-Ok (11)
    Arguments
        Channel-Id: <MISSING>

Frame 107: 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 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55946 (55946), Dst Port: amqp (5672), Seq: 381, Ack: 385, Len: 26
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 18
    Class: Channel (20)
    Method: Close (40)
    Arguments
        Reply-Code: 200
        Reply-Text: Goodbye
        Class-Id: 0
        Method-Id: 0

Frame 109: 68 bytes on wire (544 bits), 68 bytes captured (544 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55946 (55946), Seq: 385, Ack: 407, Len: 12
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 4
    Class: Channel (20)
    Method: Close-Ok (41)
    Arguments

Frame 111: 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 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55946 (55946), Dst Port: amqp (5672), Seq: 407, Ack: 397, Len: 26
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 18
    Class: Connection (10)
    Method: Close (50)
    Arguments
        Reply-Code: 200
        Reply-Text: Goodbye
        Class-Id: 0
        Method-Id: 0

Frame 113: 68 bytes on wire (544 bits), 68 bytes captured (544 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55946 (55946), Seq: 397, Ack: 433, Len: 12
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 4
    Class: Connection (10)
    Method: Close-Ok (51)
    Arguments

Frame 126: 391 bytes on wire (3128 bits), 391 bytes captured (3128 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55947 (55947), Seq: 1, Ack: 9, Len: 335
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 327
    Class: Connection (10)
    Method: Start (10)
    Arguments
        Version-Major: 0
        Version-Minor: 9
        Server-Properties
            capabilities (field table): ...
            copyright (string): Copyright (C) 2007-2012 VMware, Inc.
            information (string): Licensed under the MPL.  See http://www.rabbitmq.com/
            platform (string): Erlang/OTP
            product (string): RabbitMQ
            version (string): 3.0.1
        Mechanisms: 504c41494e20414d51504c41494e
        Locales: 656e5f5553

Frame 128: 367 bytes on wire (2936 bits), 367 bytes captured (2936 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55947 (55947), Dst Port: amqp (5672), Seq: 9, Ack: 336, Len: 311
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 303
    Class: Connection (10)
    Method: Start-Ok (11)
    Arguments
        Client-Properties
            capabilities (field table): ...
            product (string): Bunny
            platform (string): ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin12.2.0]
            version (string): 0.9.0.pre4
            information (string): http://github.com/ruby-amqp/bunny
        Mechanism: PLAIN
        Response: 0062756e6e795f67656d0062756e6e795f70617373776f72...
        Locale: en_GB

Frame 130: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55947 (55947), Seq: 336, Ack: 320, Len: 20
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 12
    Class: Connection (10)
    Method: Tune (30)
    Arguments
        Channel-Max: 0
        Frame-Max: 131072
        Heartbeat: 600

Frame 132: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55947 (55947), Dst Port: amqp (5672), Seq: 320, Ack: 356, Len: 20
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 12
    Class: Connection (10)
    Method: Tune-Ok (31)
    Arguments
        Channel-Max: 0
        Frame-Max: 131072
        Heartbeat: 600

Frame 134: 84 bytes on wire (672 bits), 84 bytes captured (672 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55947 (55947), Dst Port: amqp (5672), Seq: 340, Ack: 356, Len: 28
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 20
    Class: Connection (10)
    Method: Open (40)
    Arguments
        Virtual-Host: bunny_testbed
        Capabilities: 
        .... ...0 = Insist: False

Frame 136: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55947 (55947), Seq: 356, Ack: 368, Len: 13
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 5
    Class: Connection (10)
    Method: Open-Ok (41)
    Arguments
        Known-Hosts: 

Frame 138: 69 bytes on wire (552 bits), 69 bytes captured (552 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55947 (55947), Dst Port: amqp (5672), Seq: 368, Ack: 369, Len: 13
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 5
    Class: Channel (20)
    Method: Open (10)
    Arguments
        Out-Of-Band: 

Frame 140: 72 bytes on wire (576 bits), 72 bytes captured (576 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55947 (55947), Seq: 369, Ack: 381, Len: 16
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 8
    Class: Channel (20)
    Method: Open-Ok (11)
    Arguments
        Channel-Id: <MISSING>

Frame 142: 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 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55947 (55947), Dst Port: amqp (5672), Seq: 381, Ack: 385, Len: 26
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 18
    Class: Channel (20)
    Method: Close (40)
    Arguments
        Reply-Code: 200
        Reply-Text: Goodbye
        Class-Id: 0
        Method-Id: 0

Frame 144: 68 bytes on wire (544 bits), 68 bytes captured (544 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55947 (55947), Seq: 385, Ack: 407, Len: 12
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 1
    Length: 4
    Class: Channel (20)
    Method: Close-Ok (41)
    Arguments

Frame 146: 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 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 55947 (55947), Dst Port: amqp (5672), Seq: 407, Ack: 397, Len: 26
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 18
    Class: Connection (10)
    Method: Close (50)
    Arguments
        Reply-Code: 200
        Reply-Text: Goodbye
        Class-Id: 0
        Method-Id: 0

Frame 148: 68 bytes on wire (544 bits), 68 bytes captured (544 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 55947 (55947), Seq: 397, Ack: 433, Len: 12
Advanced Message Queueing Protocol
    Type: Method (1)
    Channel: 0
    Length: 4
    Class: Connection (10)
    Method: Close-Ok (51)
    Arguments

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

Running the publisher first:

λ ~/Development/RabbitMQ/bunny.git/ master* be ruby debug/issues/78/task.rb                             
 [i] Enter a message to send
lalala
 [x] Sent  lalala

and then the consumer:

λ ~/Development/RabbitMQ/bunny.git/ master* be ruby debug/issues/78/worker.rb                           
 [*] Waiting for messages. To exit press CTRL+C
 [x] Received  lalala
 [x] Done

from bunny.

celldee avatar celldee commented on July 25, 2024

My output from the new specs running RabbitMQ 3.0.1 -

Failures:

  1. Bunny::Queue#subscribe with a non-empty queue consumes messages
    Failure/Error: delivered_data.should == ["data0", "data1", "data2"]
    expected: ["data0", "data1", "data2"]
    got: [](using ==)
    Diff:
    @@ -1,2 +1,2 @@
    -["data0", "data1", "data2"]
    +[]

    ./issue78_spec.rb:67:in `block (3 levels) in <top (required)>'

Finished in 2.88 seconds
2 examples, 1 failure

Failed examples:

rspec ./issue78_spec.rb:48 # Bunny::Queue#subscribe with a non-empty queue consumes messages

from bunny.

celldee avatar celldee commented on July 25, 2024

This is my wireshark output when I start my consumer with a queue that contains 2 short messages -

Frame 1: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 0, Len: 0

Frame 2: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 0, Ack: 1, Len: 0

Frame 3: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 1, Ack: 1, Len: 0

Frame 4: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 1, Ack: 1, Len: 8

Frame 5: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 1, Ack: 9, Len: 0

Frame 6: 401 bytes on wire (3208 bits), 401 bytes captured (3208 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 1, Ack: 9, Len: 335
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 0
Length: 327
Class: Connection (10)
Method: Start (10)
Arguments
Version-Major: 0
Version-Minor: 9
Server-Properties
capabilities (field table): ...
copyright (string): Copyright (C) 2007-2012 VMware, Inc.
information (string): Licensed under the MPL. See http://www.rabbitmq.com/
platform (string): Erlang/OTP
product (string): RabbitMQ
version (string): 3.0.1
Mechanisms: 504c41494e20414d51504c41494e
Locales: 656e5f5553

Frame 7: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 9, Ack: 336, Len: 0

Frame 8: 355 bytes on wire (2840 bits), 355 bytes captured (2840 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 9, Ack: 336, Len: 289
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 0
Length: 281
Class: Connection (10)
Method: Start-Ok (11)
Arguments
Client-Properties
capabilities (field table): ...
product (string): Bunny
platform (string): ruby 1.9.3p286 (2012-10-12 revision 37165) [i686-linux]
version (string): 0.9.0.pre4
information (string): http://github.com/ruby-amqp/bunny
Mechanism: PLAIN
Response: 006775657374006775657374
Locale: en_GB

Frame 9: 86 bytes on wire (688 bits), 86 bytes captured (688 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 336, Ack: 298, Len: 20
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 0
Length: 12
Class: Connection (10)
Method: Tune (30)
Arguments
Channel-Max: 0
Frame-Max: 131072
Heartbeat: 600

Frame 10: 86 bytes on wire (688 bits), 86 bytes captured (688 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 298, Ack: 356, Len: 20
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 0
Length: 12
Class: Connection (10)
Method: Tune-Ok (31)
Arguments
Channel-Max: 0
Frame-Max: 131072
Heartbeat: 600

Frame 11: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 356, Ack: 318, Len: 0

Frame 12: 82 bytes on wire (656 bits), 82 bytes captured (656 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 318, Ack: 356, Len: 16
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 0
Length: 8
Class: Connection (10)
Method: Open (40)
Arguments
Virtual-Host: /
Capabilities:
.... ...0 = Insist: False

Frame 13: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 356, Ack: 334, Len: 0

Frame 14: 79 bytes on wire (632 bits), 79 bytes captured (632 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 356, Ack: 334, Len: 13
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 0
Length: 5
Class: Connection (10)
Method: Open-Ok (41)
Arguments
Known-Hosts:

Frame 15: 79 bytes on wire (632 bits), 79 bytes captured (632 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 334, Ack: 369, Len: 13
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 1
Length: 5
Class: Channel (20)
Method: Open (10)
Arguments
Out-Of-Band:

Frame 16: 82 bytes on wire (656 bits), 82 bytes captured (656 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 369, Ack: 347, Len: 16
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 1
Length: 8
Class: Channel (20)
Method: Open-Ok (11)
Arguments
Channel-Id:

Frame 17: 79 bytes on wire (632 bits), 79 bytes captured (632 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 347, Ack: 385, Len: 13
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 2
Length: 5
Class: Channel (20)
Method: Open (10)
Arguments
Out-Of-Band:

Frame 18: 82 bytes on wire (656 bits), 82 bytes captured (656 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 385, Ack: 360, Len: 16
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 2
Length: 8
Class: Channel (20)
Method: Open-Ok (11)
Arguments
Channel-Id:

Frame 19: 96 bytes on wire (768 bits), 96 bytes captured (768 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 360, Ack: 401, Len: 30
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 2
Length: 22
Class: Queue (50)
Method: Declare (10)
Arguments
Ticket: 0
Queue: task_queue
.... ...0 = Passive: False
.... ..1. = Durable: True
.... .0.. = Exclusive: False
.... 0... = Auto-Delete: False
...0 .... = Nowait: False
Arguments

Frame 20: 97 bytes on wire (776 bits), 97 bytes captured (776 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 401, Ack: 390, Len: 31
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 2
Length: 23
Class: Queue (50)
Method: Declare-Ok (11)
Arguments
Queue: task_queue
Message-Count: 2
Consumer-Count: 0

Frame 21: 85 bytes on wire (680 bits), 85 bytes captured (680 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 390, Ack: 432, Len: 19
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 2
Length: 11
Class: Basic (60)
Method: Qos (10)
Arguments
Prefetch-Size: 0
Prefetch-Count: 1
.... ...0 = Global: False

Frame 22: 78 bytes on wire (624 bits), 78 bytes captured (624 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 432, Ack: 409, Len: 12
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 2
Length: 4
Class: Basic (60)
Method: Qos-Ok (11)
Arguments

Frame 23: 97 bytes on wire (776 bits), 97 bytes captured (776 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 409, Ack: 444, Len: 31
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 2
Length: 23
Class: Basic (60)
Method: Consume (20)
Arguments
Ticket: 0
Queue: task_queue
Consumer-Tag:
.... ...0 = No-Local: False
.... ..0. = No-Ack: False
.... .0.. = Exclusive: False
.... 0... = Nowait: False
Filter

Frame 24: 250 bytes on wire (2000 bits), 250 bytes captured (2000 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 444, Ack: 440, Len: 184
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 2
Length: 36
Class: Basic (60)
Method: Consume-Ok (21)
Arguments
Consumer-Tag: amq.ctag-74qvMgHQcikGwClWTdzjFg
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 2
Length: 57
Class: Basic (60)
Method: Deliver (60)
Arguments
Consumer-Tag: amq.ctag-74qvMgHQcikGwClWTdzjFg
Delivery-Tag: 1
.... ...1 = Redelivered: True
Exchange:
Routing-Key: task_queue
Advanced Message Queueing Protocol
Type: Content header (2)
Channel: 2
Length: 41
Class ID: Basic (60)
Weight: 0
Body size: 18
Property flags: 0x9800
Properties
Content-Type: application/octet-stream
Delivery-Mode: 2
Priority: 0
Advanced Message Queueing Protocol
Type: Content body (3)
Channel: 2
Length: 18
Payload: 4e6f7720776520697320706c6179696e2031

Frame 25: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 440, Ack: 628, Len: 0

Frame 26: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 51578 (51578), Dst Port: amqp (5672), Seq: 440, Ack: 628, Len: 0

Frame 27: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: amqp (5672), Dst Port: 51578 (51578), Seq: 628, Ack: 441, Len: 0

from bunny.

celldee avatar celldee commented on July 25, 2024

I installed RabbitMQ 3.0.1 on a server running Ubuntu 12.04.1 LTS (64bit), Erlang R14B04 and Ruby 1.9.3-0. Then I cloned the rubyamqp/bunny master branch to it and ran the issue 78 specs. The result was the same as reported above.

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

Ok, I will try to reproduce on a different machine

from bunny.

celldee avatar celldee commented on July 25, 2024

Thanks. This issue is becoming a bit of a puzzle :)

from bunny.

celldee avatar celldee commented on July 25, 2024

Eureka! I think that I've finally tracked the cause down. The responses from RabbitMQ are being processed correctly in main_loop.rb. However, the consumers hash in the channel (see Channel#basic_consume_with method) isn't getting populated until after the Channel#handle_frameset method has run. Therefore my messages aren't being processed.

Race condition?

from bunny.

celldee avatar celldee commented on July 25, 2024

If I remove the Bunny::Timer.timeout around the @continuations.pop in Channel#basic_consume_with method, then it works for me in Terminal but not when I run the spec :(

from bunny.

celldee avatar celldee commented on July 25, 2024

If I stick an ugly loop in the Channel#handle_frameset method like this:

   def handle_frameset(basic_deliver, properties, content)
      while @consumers[basic_deliver.consumer_tag].nil? do
      end
      
      consumer = @consumers[basic_deliver.consumer_tag]
  
      if consumer
        @work_pool.submit do
          consumer.call(DeliveryInfo.new(basic_deliver), MessageProperties.new(properties), content)
        end
      end
    end

Then the process waits until the @Consumers hash is populated and the test passes for me. I'm not proposing that nasty hack as a solution, but it helps to illustrate my point.

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

Thanks for digging into it. I think registering a consumer immediately when consumer tag is available and gathering messages for unknown consumers to dispatch them later is a better solution. I will look into it later today.

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

I have a fix but there's one failing test left to investigate, will wrap it up tomorrow.

from bunny.

celldee avatar celldee commented on July 25, 2024

Thanks that's great!

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

@celldee please try now with master. It should be fixed by

  • Using pre-generated tags everywhere
  • Adding consumers early where possible

We still may get a race condition if you explicitly ask for a server-generated tag and a queue has messages in it, but I'd argue that it is a RabbitMQ issue if it delivers messages before basic.consume-ok. We will see if more workarounds are needed for many real world users.

from bunny.

celldee avatar celldee commented on July 25, 2024

Looks good Michael. The issue 78 specs are green and examples run perfectly in Terminal. Everything that I've seen so far suggests that RabbitMQ always sends a basic.consume-ok before delivering messages, so I'm pretty confident that you've covered the likely scenarios. Cheers.

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

Thanks Chris.

from bunny.

rlanvin avatar rlanvin commented on July 25, 2024

I'm in the same situation as described here (consumer registered on a non-empty queue). When I start the consumer I get a random amount of warnings before the consumer is able to process the messages.

[warning] No consumer for tag bunny-1362992362000-887897339712

I tried to understand what's going on, and I think it's related to this bug. It's very random, sometimes the consumer works fine from the first message, sometime the firsts 1-5 messages generates this warning. My (very basic) understanding of this issue is that the consumer hash in Channel#handle_frameset is not always populated at the time the method is called (as described in one previous comment), so I think it could be some thread synchronisation issue (but this is a very wild guess).

Note: I'm using RabbitMQ 3.0.3.

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

@rlanvin your understanding is correct and this has been fixed a few months ago.

from bunny.

rlanvin avatar rlanvin commented on July 25, 2024

@michaelklishin I'm having this issue right now though... Am I using the wrong version of the gem? (0.9.0.pre7)

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

@rlanvin please provide a code snippet that reliably reproduces it.

from bunny.

rlanvin avatar rlanvin commented on July 25, 2024

I'd love to, but I can't reliably reproduce it - as I explained above the warning message appears a random number of times on startup (usually for the firsts couple of messages), but sometimes it doesn't appear at all (i.e. the consumer works right away from the first message). It looks as if sometimes the consumer hash in Channel#handle_frameset is populated just a tiny bit too late and so the firsts few messages are losts (hence my guess about a thread synchronisation issue).

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

@rlanvin well, any snippet that reproduces the issue at least some of the time is necessary in order to see why it happens to you.

The issue was fixed by using client-generated consumer tags that should be used to populate the consumers hash
before basic.consume is sent to the server.

from bunny.

rlanvin avatar rlanvin commented on July 25, 2024

Ok, I'm just testing with the code from the "Getting started" example, so at the moment I have nothing fancy really.

Publisher (called from a Rails controller)

conn = Bunny.new
conn.start

ch = conn.create_channel
q  = ch.queue("bunny.examples.hello_world", :auto_delete => false)
x  = ch.default_exchange

x.publish("Hello!", :routing_key => q.name)

conn.close

Consumer (called as a daemon with the daemons and daemons-rails gems):

conn = Bunny.new
conn.start

ch = conn.create_channel
q  = ch.queue("bunny.examples.hello_world", :auto_delete => false)

q.subscribe(block:true) do |delivery_info, metadata, payload|
  puts "Received #{payload}"
end

I repeat the following steps to reproduce the bug (again, it's random):

  • With my browser I call the URL to publish a couple of messages (I can see them queuing with rabbitmqctl list_queues)
  • I launch the consumer (with rake daemon:consumer)
  • Sometimes I get a few "[warning] No consumer for tag bunny-1363006921000-880757810543" before I start seing the "Received Hello"
  • I kill the consumer and start over

from bunny.

michaelklishin avatar michaelklishin commented on July 25, 2024

Thanks!

from bunny.

rlanvin avatar rlanvin commented on July 25, 2024

The issue was fixed by using client-generated consumer tags that should be used to populate the consumers hash
before basic.consume is sent to the server.

I looked at Channel#basic_consume_with and I think I understand that basic.consume is sent before register_consumer is called, not after. Therefore my guess is that sometimes the messages starts to arrive in between these two lines. Just to test I added a "sleep(10)" between @connection.send_frame(AMQ::Protocol::Basic::Consume... and register_consumer and now I get the warning reliably all the time (basically for 10 secondes after startup, the messages arrive but the consumer hash is not populated).

I hope this helps!

from bunny.

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.