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

Exchange bindings aren't recovered #410

Closed
camelpunch opened this Issue Jun 3, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@camelpunch
Contributor

camelpunch commented Jun 3, 2016

I was reading the code in channel.rb and believe that exhange bindings don't get recovered. An initial exploratory test seems to back this up.

Example session output (worth checking the steps here):

irb(main):001:0> require 'bunny'
=> true
irb(main):002:0> s=Bunny.new
=> #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>
irb(main):004:0> s.start
=> #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>
irb(main):005:0> ch=s.create_channel
=> #<Bunny::Channel:70348230310000 @id=1 @connection=#<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>>
irb(main):006:0> q=ch.queue('asdf')
=> <Bunny::Queue:0x7ff6728dca78 @name="asdf" channel=#<Bunny::Channel:70348230310000 @id=1 @connection=#<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>> @durable= @auto_delete= @exclusive= @arguments=>
irb(main):007:0> e=ch.direct('bob')
=> #<Bunny::Exchange:0x007ff6728cfbc0 @channel=#<Bunny::Channel:70348230310000 @id=1 @connection=#<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>>, @name="bob", @type=:direct, @options={:queue=>"bob", :nowait=>false}, @durable=nil, @auto_delete=nil, @internal=nil, @arguments=nil>
irb(main):008:0> f=ch.direct('fred')
=> #<Bunny::Exchange:0x007ff6738510a8 @channel=#<Bunny::Channel:70348230310000 @id=1 @connection=#<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>>, @name="fred", @type=:direct, @options={:queue=>"fred", :nowait=>false}, @durable=nil, @auto_delete=nil, @internal=nil, @arguments=nil>
irb(main):009:0> f.bind(e)
=> #<Bunny::Exchange:0x007ff6738510a8 @channel=#<Bunny::Channel:70348230310000 @id=1 @connection=#<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>>, @name="fred", @type=:direct, @options={:queue=>"fred", :nowait=>false}, @durable=nil, @auto_delete=nil, @internal=nil, @arguments=nil>
irb(main):010:0> q.bind(f)
=> <Bunny::Queue:0x7ff6728dca78 @name="asdf" channel=#<Bunny::Channel:70348230310000 @id=1 @connection=#<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>> @durable= @auto_delete= @exclusive= @arguments=>
irb(main):011:0> e.publish('foobar')
=> #<Bunny::Exchange:0x007ff6728cfbc0 @channel=#<Bunny::Channel:70348230310000 @id=1 @connection=#<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>>, @name="bob", @type=:direct, @options={:queue=>"bob", :nowait=>false}, @durable=nil, @auto_delete=nil, @internal=nil, @arguments=nil>
irb(main):012:0> q.pop
=> [{:delivery_tag=>#<Bunny::VersionedDeliveryTag:0x007ff67218a220 @tag=1, @version=0>, :redelivered=>false, :exchange=>"bob", :routing_key=>"", :channel=>#<Bunny::Channel:70348230310000 @id=1 @connection=#<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>>}, {:content_type=>"application/octet-stream", :delivery_mode=>2, :priority=>0}, "foobar"]
irb(main):013:0> E, [2016-06-03T09:46:40.042549 #2617] ERROR -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Exception in the reader loop: AMQ::Protocol::EmptyResponseError: Empty response received from the server.
E, [2016-06-03T09:46:40.042612 #2617] ERROR -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Backtrace:
E, [2016-06-03T09:46:40.042649 #2617] ERROR -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>:  /Users/pivotal/.gem/ruby/2.2.2/gems/amq-protocol-2.0.1/lib/amq/protocol/frame.rb:60:in `decode_header'
E, [2016-06-03T09:46:40.042673 #2617] ERROR -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>:  /Users/pivotal/.gem/ruby/2.2.2/gems/bunny-2.3.1/lib/bunny/transport.rb:245:in `read_next_frame'
E, [2016-06-03T09:46:40.042691 #2617] ERROR -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>:  /Users/pivotal/.gem/ruby/2.2.2/gems/bunny-2.3.1/lib/bunny/reader_loop.rb:68:in `run_once'
E, [2016-06-03T09:46:40.042734 #2617] ERROR -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>:  /Users/pivotal/.gem/ruby/2.2.2/gems/bunny-2.3.1/lib/bunny/reader_loop.rb:35:in `block in run_loop'
E, [2016-06-03T09:46:40.042771 #2617] ERROR -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>:  /Users/pivotal/.gem/ruby/2.2.2/gems/bunny-2.3.1/lib/bunny/reader_loop.rb:32:in `loop'
E, [2016-06-03T09:46:40.042791 #2617] ERROR -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>:  /Users/pivotal/.gem/ruby/2.2.2/gems/bunny-2.3.1/lib/bunny/reader_loop.rb:32:in `run_loop'
W, [2016-06-03T09:46:40.042822 #2617]  WARN -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Recovering from a network failure...
W, [2016-06-03T09:46:45.043673 #2617]  WARN -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Retrying connection on next host in line: 127.0.0.1:5672
W, [2016-06-03T09:46:45.044084 #2617]  WARN -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Could not establish TCP connection to 127.0.0.1:5672: Connection refused - connect(2) for 127.0.0.1:5672
W, [2016-06-03T09:46:45.044174 #2617]  WARN -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: TCP connection failed, reconnecting in 5.0 seconds
W, [2016-06-03T09:46:55.048704 #2617]  WARN -- #<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Retrying connection on next host in line: 127.0.0.1:5672

irb(main):014:0* e.publish('bazqux')
=> #<Bunny::Exchange:0x007ff6728cfbc0 @channel=#<Bunny::Channel:70348230310000 @id=1 @connection=#<Bunny::Session:0x7ff6721d8178 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>>, @name="bob", @type=:direct, @options={:queue=>"bob", :nowait=>false}, @durable=nil, @auto_delete=nil, @internal=nil, @arguments=nil>
irb(main):015:0> q.pop
=> [nil, nil, nil]

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 12, 2016

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 12, 2016

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 13, 2016

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 13, 2016

Move spec helpers to bottom of spec file
Having the interesting stuff at the top makes the test more readable.

Issue #410

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 13, 2016

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 13, 2016

Inline helper in broken exchange example
This allows us to read the example without 'bouncing' to the helper
definition.

Issue #410

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 13, 2016

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 13, 2016

require amq/protocol from exchange.rb
This is needed in order to load exchange.rb in solitude e.g. from a unit
test.

Issue #410

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 13, 2016

Recover exchanges and their bindings
Introduce test helper in recovery spec to expect loss, then recovery of
a predicate.

Issue #410

camelpunch added a commit to camelpunch/bunny that referenced this issue Jun 13, 2016

Rework recovery test
- Wait for state changes on HTTP API, with timeouts. This is about 3x
  faster than the previous constant sleeps on my machine.
- Silence log output
- Pend out an example that was incorrectly passing
  (attempt limits: ruby-amqp#408)

Issue #410
@camelpunch

This comment has been minimized.

Show comment
Hide comment
@camelpunch
Contributor

camelpunch commented Jun 20, 2016

@camelpunch camelpunch closed this Jun 20, 2016

michaelklishin added a commit that referenced this issue Jun 22, 2016

Re-enable recovery tests in CI
Prep for fixing #410

michaelklishin added a commit that referenced this issue Jun 22, 2016

michaelklishin added a commit that referenced this issue Jun 22, 2016

michaelklishin added a commit that referenced this issue Jun 22, 2016

Move spec helpers to bottom of spec file
Having the interesting stuff at the top makes the test more readable.

Issue #410

michaelklishin added a commit that referenced this issue Jun 22, 2016

michaelklishin added a commit that referenced this issue Jun 22, 2016

Inline helper in broken exchange example
This allows us to read the example without 'bouncing' to the helper
definition.

Issue #410

michaelklishin added a commit that referenced this issue Jun 22, 2016

michaelklishin added a commit that referenced this issue Jun 22, 2016

require amq/protocol from exchange.rb
This is needed in order to load exchange.rb in solitude e.g. from a unit
test.

Issue #410

michaelklishin added a commit that referenced this issue Jun 22, 2016

Recover exchanges and their bindings
Introduce test helper in recovery spec to expect loss, then recovery of
a predicate.

Issue #410

michaelklishin added a commit that referenced this issue Jun 22, 2016

Rework recovery test
- Wait for state changes on HTTP API, with timeouts. This is about 3x
  faster than the previous constant sleeps on my machine.
- Silence log output
- Pend out an example that was incorrectly passing
  (attempt limits: #408)

Issue #410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment