Why does iTunes think that it is quitting “unexpectedly” every time I quit

applicationscrashitunes

My iTunes (v.12.1, on OS X Yosemite 10.10.2) opens and functions just fine. But every time I quit the program, about ten seconds after quitting a dialog pops up informing me that "iTunes quit unexpectedly".

enter image description here

Of course there is nothing "unexpected" about it, since I quit the application!

I'm not sure what's going on, but I assume that after I ask iTunes to quit, it tries to write something to the library, encounters some kind of error, and crashes without completing whatever process it is attempting to perform. So far I haven't noticed any actual performance problems but I worry that something is going to go wrong eventually if I don't figure this out. Does anybody have any thoughts?

Edited: Per the request in the comments, I am pasting in (part of) the Problem Details and System Configuration info from the Problem Reporter dialog. (I'd paste the whole thing, but it exceeds the 30,000 character limit of SE.)

Process:               iTunes [94416]
Path:                  /Applications/iTunes.app/Contents/MacOS/iTunes
Identifier:            com.apple.iTunes
Version:               12.1 (12.1.0.50)
Build Info:            iTunes-1200012001000050~1
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           iTunes [94416]
User ID:               505

Date/Time:             2015-03-30 22:17:24.418 -0400
OS Version:            Mac OS X 10.10.2 (14C109)
Report Version:        11
Anonymous UUID:        26161EEE-CA0A-8120-05C2-B9F5FE4CBB1C

Sleep/Wake UUID:       6E33590F-58E7-44F6-B710-70339AC5BEB6

Time Awake Since Boot: 97000 seconds
Time Since Wake:       800 seconds

Crashed Thread:        0  iTunes main  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
Performing @selector(terminate:) from sender JRNSMenuItem 0x6080006cdc10
terminating with uncaught exception of type std::__1::bad_weak_ptr: bad_weak_ptr
abort() called

Thread 0 Crashed:: iTunes main  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff86781286 __pthread_kill + 10
1   libsystem_c.dylib               0x00007fff8b2e8b53 abort + 129
2   libc++abi.dylib                 0x00007fff8a876a21 abort_message + 257
3   libc++abi.dylib                 0x00007fff8a89e9b9 default_terminate_handler() + 243
4   libobjc.A.dylib                 0x00007fff8631a7eb _objc_terminate() + 124
5   libc++abi.dylib                 0x00007fff8a89c0a1 std::__terminate(void (*)()) + 8
6   libc++abi.dylib                 0x00007fff8a89c113 std::terminate() + 51
7   com.apple.iTunes                0x000000010ee3f9ae 0x10ee3c000 + 14766
8   com.apple.iTunes                0x000000010f68778c 0x10ee3c000 + 8697740
9   com.apple.iTunes                0x000000010f6877ce 0x10ee3c000 + 8697806
10  libc++.1.dylib                  0x00007fff853728a6 std::__1::__shared_weak_count::__release_shared() + 44
11  com.apple.iTunes                0x000000010f5b6e3a 0x10ee3c000 + 7843386
12  com.apple.iTunes                0x000000010f353dca 0x10ee3c000 + 5340618
13  com.apple.iTunes                0x000000010f353b13 0x10ee3c000 + 5339923
14  com.apple.iTunes                0x000000010f356024 0x10ee3c000 + 5349412
15  com.apple.iTunes                0x000000010f355f93 0x10ee3c000 + 5349267
16  com.apple.CoreFoundation        0x00007fff88228cdc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
17  com.apple.CoreFoundation        0x00007fff8811a244 _CFXNotificationPost + 3140
18  com.apple.Foundation            0x00007fff853cec31 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
19  com.apple.AppKit                0x00007fff89cc99af -[NSApplication terminate:] + 1759
20  libsystem_trace.dylib           0x00007fff8ea44cd7 _os_activity_initiate + 75
21  com.apple.AppKit                0x00007fff89c78b71 -[NSApplication sendAction:to:from:] + 452
22  com.apple.AppKit                0x00007fff89c92cbe -[NSMenuItem _corePerformAction] + 382
23  com.apple.AppKit                0x00007fff89c929dc -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
24  libsystem_trace.dylib           0x00007fff8ea44cd7 _os_activity_initiate + 75
25  com.apple.AppKit                0x00007fff89c91a1d -[NSMenu performKeyEquivalent:] + 359
26  com.apple.AppKit                0x00007fff89c8dfb5 -[NSApplication _handleKeyEquivalent:] + 920
27  com.apple.AppKit                0x00007fff89c1135b -[NSApplication sendEvent:] + 3937
28  com.apple.iTunes                0x000000010f356ec0 0x10ee3c000 + 5353152
29  com.apple.AppKit                0x00007fff89a9d608 -[NSApplication run] + 711
30  com.apple.iTunes                0x000000010f5ef6a6 0x10ee3c000 + 8074918
31  com.apple.iTunes                0x000000010ee3e934 0x10ee3c000 + 10548

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x00007fff86782232 kevent64 + 10
1   libdispatch.dylib               0x00007fff8ff41a6a _dispatch_mgr_thread + 52

Thread 2:: Dispatch queue: com.apple.root.default-qos
0   libsystem_kernel.dylib          0x00007fff8677c4de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8677b64f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8817cb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8817bffb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff8817b858 CFRunLoopRunSpecific + 296
5   com.apple.CoreFoundation        0x00007fff88231ef1 CFRunLoopRun + 97
6   com.apple.mobiledevice          0x000000011805bdd6 __thr_AMRegisterForCallbacks + 426
7   libdispatch.dylib               0x00007fff8ff3ec13 _dispatch_client_callout + 8
8   libdispatch.dylib               0x00007fff8ff4188f _dispatch_root_queue_drain + 935
9   libdispatch.dylib               0x00007fff8ff4ffe4 _dispatch_worker_thread3 + 91
10  libsystem_pthread.dylib         0x00007fff861e0637 _pthread_wqthread + 729
11  libsystem_pthread.dylib         0x00007fff861de40d start_wqthread + 13

Thread 3:: CFRunLoopThread
0   libsystem_kernel.dylib          0x00007fff8677c4de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8677b64f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8817cb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8817bffb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff8817b858 CFRunLoopRunSpecific + 296
5   com.apple.CoreFoundation        0x00007fff88231ef1 CFRunLoopRun + 97
6   com.apple.iTunes                0x000000010fb412a4 0x10ee3c000 + 13652644
7   com.apple.iTunes                0x000000010fb4189a 0x10ee3c000 + 13654170
8   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
9   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
10  libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 4:
0   libsystem_kernel.dylib          0x00007fff86781136 __psynch_cvwait + 10
1   com.apple.iTunes                0x000000010fb017d1 0x10ee3c000 + 13391825
2   com.apple.iTunes                0x000000010ef800cc 0x10ee3c000 + 1327308
3   com.apple.iTunes                0x000000010ef80ebc 0x10ee3c000 + 1330876
4   com.apple.iTunes                0x000000010fb4189a 0x10ee3c000 + 13654170
5   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
6   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
7   libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 5:: com.apple.CFSocket.private
0   libsystem_kernel.dylib          0x00007fff867813fa __select + 10
1   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
2   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
3   libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 6:: CoreAudioNotificationThread
0   libsystem_kernel.dylib          0x00007fff8677c4de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8677b64f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8817cb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8817bffb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff8817b858 CFRunLoopRunSpecific + 296
5   com.apple.CoreFoundation        0x00007fff88231ef1 CFRunLoopRun + 97
6   com.apple.iTunes                0x000000010f07bc25 0x10ee3c000 + 2358309
7   com.apple.iTunes                0x000000010fb4189a 0x10ee3c000 + 13654170
8   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
9   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
10  libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 7:: AFCVolumeNotificationThread
0   libsystem_kernel.dylib          0x00007fff8677c4de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8677b64f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8817cb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8817bffb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff8817b858 CFRunLoopRunSpecific + 296
5   com.apple.CoreFoundation        0x00007fff88231ef1 CFRunLoopRun + 97
6   com.apple.iTunes                0x000000010fb412a4 0x10ee3c000 + 13652644
7   com.apple.iTunes                0x000000010fb4189a 0x10ee3c000 + 13654170
8   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
9   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
10  libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 8:: CFRunLoopThread
0   libsystem_kernel.dylib          0x00007fff8677c4de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8677b64f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8817cb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8817bffb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff8817b858 CFRunLoopRunSpecific + 296
5   com.apple.CoreFoundation        0x00007fff88231ef1 CFRunLoopRun + 97
6   com.apple.iTunes                0x000000010fb412a4 0x10ee3c000 + 13652644
7   com.apple.iTunes                0x000000010fb4189a 0x10ee3c000 + 13654170
8   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
9   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
10  libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 9:: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib          0x00007fff8677c4de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8677b64f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8817cb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8817bffb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff8817b858 CFRunLoopRunSpecific + 296
5   com.apple.CFNetwork             0x00007fff87eb5c80 +[NSURLConnection(Loader) _resourceLoadLoop:] + 434
6   com.apple.Foundation            0x00007fff8543490a __NSThread__main__ + 1345
7   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
8   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
9   libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 10:: CFRunLoopThread
0   libsystem_kernel.dylib          0x00007fff8677c4de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8677b64f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8817cb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8817bffb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff8817b858 CFRunLoopRunSpecific + 296
5   com.apple.CoreFoundation        0x00007fff88231ef1 CFRunLoopRun + 97
6   com.apple.iTunes                0x000000010fb412a4 0x10ee3c000 + 13652644
7   com.apple.iTunes                0x000000010fb4189a 0x10ee3c000 + 13654170
8   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
9   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
10  libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 11:: CFRunLoopThread
0   libsystem_kernel.dylib          0x00007fff8677c4de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8677b64f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8817cb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8817bffb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff8817b858 CFRunLoopRunSpecific + 296
5   com.apple.CoreFoundation        0x00007fff88231ef1 CFRunLoopRun + 97
6   com.apple.iTunes                0x000000010fb412a4 0x10ee3c000 + 13652644
7   com.apple.iTunes                0x000000010fb4189a 0x10ee3c000 + 13654170
8   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
9   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
10  libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 12:: CFRunLoopThread
0   libsystem_kernel.dylib          0x00007fff8677c4de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8677b64f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8817cb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8817bffb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff8817b858 CFRunLoopRunSpecific + 296
5   com.apple.CoreFoundation        0x00007fff88231ef1 CFRunLoopRun + 97
6   com.apple.iTunes                0x000000010fb412a4 0x10ee3c000 + 13652644
7   com.apple.iTunes                0x000000010fb4189a 0x10ee3c000 + 13654170
8   libsystem_pthread.dylib         0x00007fff861e0268 _pthread_body + 131
9   libsystem_pthread.dylib         0x00007fff861e01e5 _pthread_start + 176
10  libsystem_pthread.dylib         0x00007fff861de41d thread_start + 13

Thread 13:
0   libsystem_kernel.dylib          0x00007fff8678194a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff861de40d start_wqthread + 13

Thread 14:
0   libsystem_kernel.dylib          0x00007fff8678194a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff861de40d start_wqthread + 13

Thread 15:
0   libsystem_kernel.dylib          0x00007fff8678194a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff861de40d start_wqthread + 13

Thread 16:
0   libsystem_kernel.dylib          0x00007fff8678194a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff861de40d start_wqthread + 13

Thread 17:
0   libsystem_kernel.dylib          0x00007fff8678194a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff861de40d start_wqthread + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000000000006  rcx: 0x00007fff50dc2638  rdx: 0x0000000000000000
  rdi: 0x000000000000130f  rsi: 0x0000000000000006  rbp: 0x00007fff50dc2660  rsp: 0x00007fff50dc2638
   r8: 0x0000000000000000   r9: 0x00007fff8b312d70  r10: 0x0000000008000000  r11: 0x0000000000000206
  r12: 0x00007fff50dc27c0  r13: 0x000060000083b480  r14: 0x00007fff73714300  r15: 0x00007fff50dc26a0
  rip: 0x00007fff86781286  rfl: 0x0000000000000206  cr2: 0x00007fff74616fd8

Logical CPU:     0
Error Code:      0x02000148
Trap Number:     133

Edit 2: Per the request of Alistair McMillan, I have run EtreCheck and posted the results into a Gist at https://gist.github.com/anonymous/ce604dc989850467849b.

Edit 3: Smooosher suggested I open iTunes in safe mode. I have done that, and the error message did not occur when I quit. But what is really surprising is that I have since opened and closed iTunes several times not in safe mode, and the problem seems to have disappeared! I am not quite sure what happened, or how I fixed it (or if the fix will last), and I will still happily award the bounty to anybody who can explain what was and is going on here.

Best Answer

The EtreCheck scan has found multiple pieces of adware on your Mac, remove them all. My guess is that one of these adware were trying to hook into the iTunes executable (or the operating system itself) and causing the crashes when iTunes was trying to terminate.

You can find instructions on how to remove Conduit here. I'd remove this first and then open the Extensions window in Safari and uninstall the three extensions that were identified as adware.

You have Sophos installed. I'd make sure it is up to date and updating regularly. Ideally you'd have hoped it would have caught and prevented these infections.

In the interests of system stability, I'd also go through the list of installed software that EtreCheck has found and remove anything you no longer use. For example the Startup Items which no longer work in Yosemite.