Using a rabbit mq installed with official docker image my worker fail with the exception Bunny::NoFinalOctetError after some time (around 40s) .
My worker code is :
require 'bunny'
require 'securerandom'
#TODO set host as parameter
rabbit_conn = Bunny.new
rabbit_conn.start
ch = rabbit_conn.create_channel
q = ch.queue("task", :durable => true)
ch.prefetch(1)
begin
q.subscribe(:manual_ack => true, :block => true) do |delivery_info, properties, body|
pp body
ch.ack(delivery_info.delivery_tag)
end
rescue Interrupt => _
rabbit_conn.close
end
I send data via the following code :
require "bunny"
conn = Bunny.new
conn.start
ch = conn.create_channel
q = ch.queue("task", :durable => true)
[
'titi',
'toto',
'tata'
].each do |d|
q.publish(d, :persistent => true)
end
sleep 1.0
conn.close
and after arround 40s I get the folllowing output in my worker
"titi"
"toto"
"tata"
E, [2017-10-18T15:56:55.938661 #28583] ERROR -- #<Bunny::Session:0x56182de41e48 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Exception in the reader loop: Bunny::NoFinalOctetError: Frame doesn't end with � as it must, which means the size is miscalculated.
E, [2017-10-18T15:56:55.938890 #28583] ERROR -- #<Bunny::Session:0x56182de41e48 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Backtrace:
E, [2017-10-18T15:56:55.939037 #28583] ERROR -- #<Bunny::Session:0x56182de41e48 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: /home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/transport.rb:255:in `read_next_frame'
E, [2017-10-18T15:56:55.939114 #28583] ERROR -- #<Bunny::Session:0x56182de41e48 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: /home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/reader_loop.rb:68:in `run_once'
E, [2017-10-18T15:56:55.939175 #28583] ERROR -- #<Bunny::Session:0x56182de41e48 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: /home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/reader_loop.rb:35:in `block in run_loop'
E, [2017-10-18T15:56:55.939233 #28583] ERROR -- #<Bunny::Session:0x56182de41e48 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: /home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/reader_loop.rb:32:in `loop'
E, [2017-10-18T15:56:55.939288 #28583] ERROR -- #<Bunny::Session:0x56182de41e48 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: /home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/reader_loop.rb:32:in `run_loop'
Traceback (most recent call last):
5: from worker2.rb:21:in `<main>'
4: from /home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/queue.rb:196:in `subscribe'
3: from /home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/consumer_work_pool.rb:77:in `join'
2: from /home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/consumer_work_pool.rb:77:in `each'
1: from /home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/consumer_work_pool.rb:77:in `block in join'
/home/gg/.rvm/gems/ruby-head/gems/bunny-2.7.1/lib/bunny/consumer_work_pool.rb:77:in `join': caught an unexpected exception in the network loop: Frame doesn't end with � as it must, which means the size is miscalculated. (Bunny::NetworkFailure)
Update about the network
I sniffed the network as it seems to be a malformed network packet. And indeed, the error is trigger after receiving a spécific packet.
Whireshark capture below, the error occur when receiving the packet 299.
Yet I have no idea what this packet is, nor why it is not handled by bunny.
Update Github Ticket
I opened a ticket here