The following code often crashes on Signal.
TOCFutureSource* futureResultSource = [TOCFutureSource futureSourceUntil:untilCancelledToken];
PacketHandlerBlock packetHandler = ^(id packet) {
if (![futureResultSource trySetResult:packet]) {;
errorHandler([IgnoredPacketFailure new:@"Received another packet before relay socket events redirected to new handler."], packet, false);
}
};
Crash stack traces are showing that it crashes inside TOCFutureSource _tryComplete:succeeded:
Thread 2 name:
Thread 2 Crashed:
0 libobjc.A.dylib 0x00000001938f0174 objc_release + 20 (objc-object.h:419)
1 Signal 0x0000000100289be0 -[TOCFutureSource _tryComplete:succeeded:] + 84 (TOCFutureAndSource.m:386)
2 Signal 0x0000000100289c8c -[TOCFutureSource trySetResult:] + 144 (TOCFutureAndSource.m:396)
3 Signal 0x000000010002ef38 __102+[CallConnectUtil_Server asyncFirstPacketReceivedAfterStartingSocket:untilCancelled:withErrorHandler:]_block_invoke + 52 (CallConnectUtil_Server.m:183)
4 Signal 0x00000001000d53e0 -[PacketHandler handlePacket:] + 28 (PacketHandler.m:21)
5 Signal 0x00000001000817d0 -[UdpSocket onReceivedData:withEventType:from:] + 428 (UdpSocket.m:114)
6 Signal 0x00000001000815dc onReceivedData + 140 (UdpSocket.m:92)
7 CoreFoundation 0x000000018206f594 __CFSocketPerformV0 + 768 (CFSocket.c:2862)
8 CoreFoundation 0x000000018206c23c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20 (CFRunLoop.c:1763)
9 CoreFoundation 0x000000018206b4e0 __CFRunLoopDoSources0 + 260 (CFRunLoop.c:1809)
10 CoreFoundation 0x0000000182069590 __CFRunLoopRun + 708 (CFRunLoop.c:2526)
11 CoreFoundation 0x0000000181f952d0 CFRunLoopRunSpecific + 392 (CFRunLoop.c:2795)
12 Foundation 0x0000000182ecd4c4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 312 (NSRunLoop.m:366)
13 Foundation 0x0000000182eefa5c -[NSRunLoop(NSRunLoop) runUntilDate:] + 104 (NSRunLoop.m:407)
14 Signal 0x0000000100084fc0 -[RunningThreadRunLoopPair runLoopUntilCancelled] + 212 (ThreadManager.m:33)
15 Foundation 0x0000000182fb5db4 __NSThread__main__ + 1068 (NSThread.m:1113)
16 libsystem_pthread.dylib 0x000000019410bdc4 _pthread_body + 160 (pthread.c:644)
17 libsystem_pthread.dylib 0x000000019410bd20 _pthread_start + 156 (pthread.c:680)
18 libsystem_pthread.dylib 0x0000000194108ef4 thread_start + 0 (pthread_asm.s:188)
which refers to
-(bool) _tryComplete:(id)value succeeded:(bool)succeeded {
bool didSet = [future _ForSource_tryComplete:value succeeded:succeeded];
if (!didSet) return false;
[_cancelledOnCompletedSource_ClearedOnSet cancel];
_cancelledOnCompletedSource_ClearedOnSet = nil;
return true;
}
My assumption is that _cancelledOnCompletedSource_ClearedOnSet is already deallocated at that point. Thoughts @Strilanc?
The following code often crashes on Signal.
Crash stack traces are showing that it crashes inside
TOCFutureSource _tryComplete:succeeded:which refers to
My assumption is that
_cancelledOnCompletedSource_ClearedOnSetis already deallocated at that point. Thoughts @Strilanc?