rabbitmq / rabbitmq-objc-client

RabbitMQ client for Objective-C and Swift
https://rabbitmq.com
Other
242 stars 84 forks source link

Heartbeat sender being a weak ref can cause the client to miss sending heartbeats #224

Open aurban-iqmessenger opened 7 months ago

aurban-iqmessenger commented 7 months ago

Describe the bug

Connection is dropped shortly after success because of absent heartbeat.

Reproduction steps

  1. Update to 0.12.0
  2. Create an RMQConnection instance with some heartbeat interval, 2 seconds for example
  3. Connect
  4. In several seconds connection is closed by remote peer. Server logs report there were no heartbeats.

Expected behavior

Connection is long-lived

Additional context

Debugged this to the -[RMQConnection start:] method, upon completion of a handshake the first thing the connection does is [strongThis.heartbeatSender startWithInterval:@(heartbeatTimeout.integerValue / 2)];, but the heartbeatSender is nil. heartbeatSender was created during the initialization, though. Found it has been made weak in #194.

michaelklishin commented 7 months ago

Thanks for the details.

michaelklishin commented 7 months ago

A quick attempt at a fix suggests we need to modernize the build system first a bit to work with the latest XCode on aarch64.

kurt0615 commented 3 months ago

can i use rabbitmq-objc-client-224 replace version 0.12.0 for solve weak ref problem?