facebookincubator / SocketRocket

A conforming Objective-C WebSocket client library.
Other
9.54k stars 2.01k forks source link

Crash: message sent to deallocated SRProxyConnect when opening socket from multiple threads #548

Open Antanas opened 6 years ago

Antanas commented 6 years ago

Hi, Thanks for great library!

We saw some crashes when calling [SRWebSocket open] multiple times from different threads. Seems that message is sent to already deallocated SRProxyConnect object.

Possible cause of this could be: SRWebSocket.m line 362

// Schedule to run on a work queue, to make sure we don't run this inline and deallocate `self` inside `SRProxyConnect`.
    // TODO: (nlutsenko) Find a better structure for this, maybe Bolts Tasks?
    dispatch_async(_workQueue, ^{
        _proxyConnect = nil;
    });

As a workaround we just added a flag to call open method just once