Skip to content

Commit f182699

Browse files
committed
Ignore Frame Size Errors in defintions.amqp
There was a bug in frame size calulcation of exchange to exchange binding frames which addes two bytes to the frame size. In a newer version of amq-protocol frame size validation is enforced, so if there was a e2e binding frame in the `defintions.amqp` file on boot, it prevented the server from starting. With amq-protocl 1.1.20 fixes compability with e2e bindings From old versions (amq-protocol <1.1.16, lavinmq <2.5.0)
1 parent cf2d986 commit f182699

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

shard.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ shards:
66

77
amq-protocol:
88
git: https://github.com/cloudamqp/amq-protocol.cr.git
9-
version: 1.1.19
9+
version: 1.1.20
1010

1111
amqp-client:
1212
git: https://github.com/cloudamqp/amqp-client.cr.git
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
require "./spec_helper"
2+
require "file_utils"
3+
4+
describe LavinMQ::VHost do
5+
it "should handle definitions files from v2.4.3 with frame size errors" do
6+
Dir.mkdir_p File.join(LavinMQ::Config.instance.data_dir, "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3")
7+
File.open(File.join(LavinMQ::Config.instance.data_dir, "vhosts.json"), "w") do |f|
8+
[{"name": "test", "dir": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"}].to_json(f)
9+
end
10+
FileUtils.cp(
11+
File.join(__DIR__, "fixtures", "v243_e2e_binding.amqp"),
12+
File.join(
13+
LavinMQ::Config.instance.data_dir,
14+
"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
15+
"definitions.amqp"
16+
)
17+
)
18+
with_amqp_server do |s|
19+
exchanges = s.vhosts["test"].exchanges
20+
src_x = exchanges["source.exchange"]
21+
dst_x = exchanges["destination.exchange"]
22+
src_x.bindings_details.to_a.should_not be_empty
23+
dst_x.bindings_details.to_a.should_not be_empty
24+
end
25+
end
26+
end
461 Bytes
Binary file not shown.

spec/spec_helper.cr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ def with_amqp_server(tls = false, replicator = nil,
9797
config = LavinMQ::Config.instance,
9898
file = __FILE__, line = __LINE__, & : LavinMQ::Server -> Nil)
9999
LavinMQ::Config.instance = init_config(config)
100-
FileUtils.rm_rf(config.data_dir)
101100
tcp_server = TCPServer.new("localhost", ENV.has_key?("NATIVE_PORTS") ? 5672 : 0)
102101
s = LavinMQ::Server.new(config, replicator)
103102
begin

0 commit comments

Comments
 (0)