rabbitmq / rabbitmq-objc-client

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

testConcurrentDeliveryOnDifferentChannels sporadic crash #56

Closed camelpunch closed 8 years ago

camelpunch commented 8 years ago

This usually happens during a semaphore wait, but that could be coincidental.

Possibly unrelated: increasing the channel count to 1000 produces some interesting errors.

Many of these:

2016-04-28 16:07:36.697 xctest[47665:2264431] Received connection: <RMQConnection: 0x7fd5ab80bbf0> failedToOpenChannel: <RMQAllocatedChannel: 0x7fd5a9d312f0> {
    active = 1;
    channelNumber = 88;
    commandQueue = "<RMQGCDSerialQueue: 0x7fd5a9d2ed50>";
    consumers =     {
    };
    delegate = "<RMQQueuingConnectionDelegateProxy: 0x7fd5ab80e330>";
    exchanges =     {
    };
    nameGenerator = "<RMQProcessInfoNameGenerator: 0x7fd5ab80c9b0>";
    prefetchCount = 0;
    prefetchGlobal = 0;
    queues =     {
        "rmq-objc-client.gen-DE4A0490-0FFE-4F48-93C5-3B250E17EE17-47665-00009AAFB74ACF97" = "<RMQQueue: 0x7fd5a9e09260>";
    };
    sender = "<RMQConnection: 0x7fd5ab80bbf0>";
    waiter = "<RMQFramesetSemaphoreWaiter: 0x7fd5a9d30b40>";
} error: Error Domain=com.rabbitmq.rabbitmq-objc-client Code=3 "Timed out waiting for RMQChannelOpenOk." UserInfo={NSLocalizedDescription=Timed out waiting for RMQChannelOpenOk.}

Then many of these:

2016-04-28 16:07:38.445 xctest[47665:2264437] Received channel: <RMQAllocatedChannel: 0x7fd5a9cf0770> {
    active = 1;
    channelNumber = 594;
    commandQueue = "<RMQGCDSerialQueue: 0x7fd5a9cefa00>";
    consumers =     {
    };
    delegate = "<RMQQueuingConnectionDelegateProxy: 0x7fd5ab80e330>";
    exchanges =     {
    };
    nameGenerator = "<RMQProcessInfoNameGenerator: 0x7fd5ab80c9b0>";
    prefetchCount = 0;
    prefetchGlobal = 0;
    queues =     {
        "rmq-objc-client.gen-DE4A0490-0FFE-4F48-93C5-3B250E17EE17-47665-00009AAFB74ACF97" = "<RMQQueue: 0x7fd5a9cf10e0>";
    };
    sender = "<RMQConnection: 0x7fd5ab80bbf0>";
    waiter = "<RMQFramesetSemaphoreWaiter: 0x7fd5a9ceffd0>";
} error: Error Domain=com.rabbitmq.rabbitmq-objc-client Code=4 "Expected RMQQueueDeclareOk, got RMQChannelOpenOk." UserInfo={NSLocalizedDescription=Expected RMQQueueDeclareOk, got RMQChannelOpenOk.}

The above is probably #57

I suspect we're flooding the socket with writes and not handling reads in between.

camelpunch commented 8 years ago

Removing the heartbeat code makes this test pass reliably. We need to re-implement client heartbeats with a timer dispatch source

camelpunch commented 8 years ago

It turns out this is a -[__NSDate release]: message sent to deallocated instance. It only occurs when last activity date recording code is present.