Repository navigation
Replies: 2 comments 3 replies
|
@matvey-b given that this is clearly an edge case specific to your environment, it's on you to prove that what you are suggesting cannot break realistic installations. I don't think |
|
Fair point, guessing isn't the right approach. Two opt-in alternatives that keep the current behaviour by default:
Either would solve this for us. Would one of them be acceptable? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
On hosts named like
1.rabbitmq.example.com(our container platform names instances this way), each stream replica reader connection takes ~19.5 s, and the readers on a writer node connect one after another. After restarting one node of a 3-node cluster, the last stream replica reattached 2.5 minutes later; the log showsreplica reader successfully connected to host "<fqdn>"every 19.455 s.inet:gethostname/0truncates the host name at the first dot and returns"1".inetparses"1"as the IPv4 address 0.0.0.1 without any name resolution, andinet:getaddrs("1", inet)returns the same address. With TLS replication,combine_ips_hosts/4inosiris_replica.erlthen producesNodes run with
RABBITMQ_USE_LONGNAME=true(node namesrabbit@<fqdn>), which is why the second entry works.maybe_connect/6inosiris_replica_reader.erltries"1"first.ssl:connect/3is called without a timeout and 0.0.0.1 is routed via the default gateway, so the call only returns after the kernel's TCP connect timeout. The node-name host then connects immediately. Sinceosiris_replica_reader:start/2runsinit/1undersupervisor:start_child/2on the writer node, these attempts are serialised.The code involved is the same on
main.Reproduction steps
hostnamereturns an FQDN whose first label is numeric (1.rabbitmq.example.com,2.rabbitmq.example.com, …), withRABBITMQ_USE_LONGNAME=trueandosirisreplication_transportset tosslreplica reader successfully connectedlines come one per TCP connect timeout (~19.5 s on our nodes), not right awayOn a node, the parts of the chain can be checked directly:
Expected behavior
The replica reader connects to the replica right away using a reachable address, without waiting for a connection to 0.0.0.1 to time out. A possible fix is to ignore an
inet:gethostname/0result that parses as an IP address, since it is always a truncated name, and use the host from the node name instead. A connect timeout inmaybe_connect/6would also limit the delay.Additional context
RabbitMQ 4.3.5, Erlang 27.3.4.6, Oracle Linux 10 container image on a Linux 6.6 host kernel,
tcp_syn_retries = 3,tcp_syn_linear_timeouts = 4.This is how we noticed it: a stream with 1 MB segments, a short
max-ageand ~1 MB/s of traffic could not get its replicas back after a node restart. A replica that restarts empty requests the writer's first offset, and by the time its reader connected, that offset had already been removed by retention (data reader requested an offset (X) that was out of range: {Y,Z}, replica reader will not start). We know 1 MB segments were a misconfiguration on our side (the default is 500 MB) and have fixed it. The connect delay itself is still there and slows down every replica (re)start on such hosts.All reactions