How to debug crash in NSOperation?
How to debug crash in NSOperation?
- Subject: How to debug crash in NSOperation?
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Mon, 27 Mar 2017 10:06:55 +0700
macOS 12.3
This is a rather rare bug (never seen before):
Thread 12 Crashed:: Dispatch queue: เสือ :: NSOperation 0x61800184fbd0 (QOS: UTILITY)
0 libsystem_kernel.dylib 0x00007fffb3d65dd6 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fffb3e51787 pthread_kill + 90
2 libsystem_c.dylib 0x00007fffb3ccb420 abort + 129
3 libc++abi.dylib 0x00007fffb282885a abort_message + 266
4 libc++abi.dylib 0x00007fffb284dc4f default_terminate_handler() + 267
5 libobjc.A.dylib 0x00007fffb3357b8e _objc_terminate() + 103
6 libc++abi.dylib 0x00007fffb284ad69 std::__terminate(void (*)()) + 8
7 libc++abi.dylib 0x00007fffb284ade3 std::terminate() + 51
8 libdispatch.dylib 0x00007fffb3c010cc _dispatch_client_callout + 28
9 libdispatch.dylib 0x00007fffb3c17ae5 _dispatch_queue_serial_drain + 896
10 libdispatch.dylib 0x00007fffb3c09cd9 _dispatch_queue_invoke + 1046
11 libdispatch.dylib 0x00007fffb3c02e70 _dispatch_root_queue_drain + 476
12 libdispatch.dylib 0x00007fffb3c02c47 _dispatch_worker_thread3 + 99
13 libsystem_pthread.dylib 0x00007fffb3e4e712 _pthread_wqthread + 1299
14 libsystem_pthread.dylib 0x00007fffb3e4e1ed start_wqthread + 13
The NSOperationQueue named “ เสือ" is created at the start of the app thusly:
@interface EchoStreamServer()
@property (strong) NSOperationQueue *commandOperationQueue;
@end
@implementation EchoStreamServer
- (instancetype)initWithInputStream: (NSInputStream *)istr outputStream:(NSOutputStream *)ostr owner: (id <EchoProtocol>)oo security: securityThing service: (NSNetService *)svice;
{
self = [ super initWithInputStream: istr …. ];
if ( self == nil ) return nil;
_commandOperationQueue = [ [ NSOperationQueue alloc ] init ];
_commandOperationQueue.name = @"เสือ";
_commandOperationQueue.qualityOfService = [ oo echoQualityOfService ]; // NSQualityOfServiceUtility
return self;
}
// this is called as answer to a request from a client:
- (void)sendToOwnerObject: obb seqNbr: (NSUInteger)seqNbr;
{
if ( self.owner == nil )…. // error
NSBlockOperation *echoOperation = [ [ NSBlockOperation alloc ] init ];
__weak NSBlockOperation *weakBo = echoOperation;
[ echoOperation addExecutionBlock: ^void(void)
{ [ self.owner echoObject: obb
seqNbr: seqNbr
from: self
operation: weakBo
];
}
];
[ self.commandOperationQueue addOperation: echoOperation ];
}
// this probably is never called:
- (void)cancelEchoOperations: (BOOL)explicit;
{
[ self.commandOperationQueue cancelAllOperations ];
…
}
Any ideas how to debug this?
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden