2013-05-07

IMTransferAgent



Oef, I was worried that there would be no crash today.
I even considered to describe some earlier crashes, which would be a bit lame, although there are some impressive ones I'd like to post here.

But luckily, 17:55, nearing the end of the working day, IMTransferAgent saved the day.
With no apparent cause, just the move of the mouse after some idling, the crashreporter showed this beauty:


Process:         IMTransferAgent [479]
Path:            /System/Library/PrivateFrameworks/IMTransferServices.framework/XPCServices/IMTransferAgent.xpc/Contents/MacOS/IMTransferAgent
Identifier:      IMTransferAgent
Version:         8.0 (900)
Code Type:       X86-64 (Native)
Parent Process:  ??? [1]
User ID:         501

Date/Time:       2013-05-07 17:53:24.873 +0200
OS Version:      Mac OS X 10.8.3 (12D78)
Report Version:  10


Crashed Thread:  3  Dispatch queue: SSLContextHelper

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT



Thread 3 Crashed:: Dispatch queue: SSLContextHelper
0   com.apple.security             0x00007fff87dccdf5 Security::RefPointer<Security::CssmClient::ObjectImpl>::release() + 21
1   com.apple.security             0x00007fff87e1e5c6 std::_Rb_tree<long, std::pair<long const, SSDatabase>, std::_Select1st<std::pair<long const, SSDatabase> >, std::less<long>, std::allocator<std::pair<long const, SSDatabase> > >::_M_erase(std::_Rb_tree_node<std::pair<long const, SSDatabase> >*) + 46
2   com.apple.security             0x00007fff87e75f2e SSDLSession::~SSDLSession() + 590
3   com.apple.security             0x00007fff87e1e32a SSDLSession::~SSDLSession() + 18
4   com.apple.security             0x00007fff87df1b0a Security::CssmPlugin::moduleDetach(long) + 220
5   com.apple.security             0x00007fff87e1e28f CSSM_SPI_ModuleDetach__apple_cspdl + 35
6   com.apple.security             0x00007fff87df1861 Attachment::detach(bool) + 127
7   com.apple.security             0x00007fff87df164f CSSM_ModuleDetach + 33
8   com.apple.security             0x00007fff87df15f8 Security::CssmClient::AttachmentImpl::deactivate() + 44
9   com.apple.security             0x00007fff87df1593 Security::CssmClient::AttachmentImpl::~AttachmentImpl() + 31
10  com.apple.security             0x00007fff87e1e226 Security::CssmClient::CSPDLImpl::~CSPDLImpl() + 32
11  com.apple.security             0x00007fff87e8f421 Security::CssmClient::SSCSPDLImpl::~SSCSPDLImpl() + 25
12  com.apple.security             0x00007fff87dcce28 Security::RefPointer<Security::CssmClient::ObjectImpl>::release() + 72
13  com.apple.security             0x00007fff87de601c Security::CssmClient::ObjectImpl::~ObjectImpl() + 54
14  com.apple.security             0x00007fff87e1e0a3 Security::CssmClient::SSDbImpl::~SSDbImpl() + 25
15  com.apple.security             0x00007fff87dcce28 Security::RefPointer<Security::CssmClient::ObjectImpl>::release() + 72
16  com.apple.security             0x00007fff87f34937 Security::KeychainCore::KeychainImpl::~KeychainImpl() + 239
17  com.apple.security             0x00007fff87e1df32 Security::KeychainCore::KeychainImpl::~KeychainImpl() + 18
18  com.apple.security             0x00007fff87dccf2a Security::CFClass::refCountForType(long, void const*) + 190
19  com.apple.CoreFoundation       0x00007fff8de83324 CFRelease + 324
20  com.apple.security             0x00007fff87deca5f std::vector<Security::KeychainCore::Keychain, std::allocator<Security::KeychainCore::Keychain> >::~vector() + 33
21  com.apple.security             0x00007fff87f2e4b4 Security::KeychainCore::Trust::~Trust() + 48
22  com.apple.security             0x00007fff87e1da86 Security::KeychainCore::Trust::~Trust() + 18
23  com.apple.security             0x00007fff87dccf2a Security::CFClass::refCountForType(long, void const*) + 190
24  com.apple.CoreFoundation       0x00007fff8de83324 CFRelease + 324
25  com.apple.security             0x00007fff87e532a3 _sslContextDestroy + 156
26  com.apple.CoreFoundation       0x00007fff8de833df CFRelease + 511
27  com.apple.security             0x00007fff87e2599e SSLDisposeContext + 19
28  com.apple.CFNetwork           0x00007fff910236ae __removeRetain_block_invoke_0 + 39
29  libdispatch.dylib             0x00007fff8e262f01 _dispatch_call_block_and_release + 15
30  libdispatch.dylib             0x00007fff8e25f0b6 _dispatch_client_callout + 8
31  libdispatch.dylib             0x00007fff8e26047f _dispatch_queue_drain + 235
32  libdispatch.dylib             0x00007fff8e2602f1 _dispatch_queue_invoke + 52
33  libdispatch.dylib             0x00007fff8e2601c3 _dispatch_worker_thread2 + 249
34  libsystem_c.dylib             0x00007fff87ce0d0b _pthread_wqthread + 404
35  libsystem_c.dylib             0x00007fff87ccb1d1 start_wqthread + 13



I've posted the relevant parts of the crashlog. Let's see what went wrong here.
IMTransferAgent's name suggests it handles Instant-Message file transfers. Because its name, and the fact that it runs as a deamon, the fact that is uses a lot of Apple libraries, it can only be a helper deamon of Messages.app. The same Messages.app that did not let me log in yesterday.

What's interesting here is that the crash is actually caused by (the usage of) the core apple security library. So what was the IMTransferAgent doing? The stack tells us some object got released, and the implementation of release crashed. Earlier in the stack we see _sslContextDestroy, probably the server communication has ended and upon finalising the deamon crashed.

This code is open source.
Let me find some time later, and describe in more detail what went wrong.

Could this have been done better? YES.
The deamon could have handled it's own crash and restarted without showing a crashlog to the user.





No comments:

Post a Comment