Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminal.app crashing on Mac OS X after upgrade to 10.12 Sierra

After upgrading Mac OS X from El Capitan to Sierra (10.12.2), Terminal.app is frequently crashing, several times per day. I'll be in the middle of typing a command or editing a file and it crashes. Anyone else seeing this issue or know what to do about it (besides switch to iTerm 2)?

(edit) Here is stack trace (omitted the tailing loaded dynamic libraries to keep the length reasonable):

Process:               Terminal [17579]
Path:                  /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
Identifier:            com.apple.Terminal
Version:               2.7.1 (388)
Build Info:            Terminal-388000000000000~2
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Terminal [17579]
User ID:               501

Date/Time:             2017-01-25 16:55:07.676 -0800
OS Version:            Mac OS X 10.12.2 (16C68)
Report Version:        12
Anonymous UUID:        XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Sleep/Wake UUID:       XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Time Awake Since Boot: 59000 seconds
Time Since Wake:       3700 seconds

System Integrity Protection: enabled

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

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0:
--> 
    __TEXT                 00000001070d8000-00000001071a8000 [  832K] r-x/rwx SM=COW  /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_platform.dylib        0x00007fff9f916f56 _platform_memmove$VARIANT$Haswell + 182
1   com.apple.Terminal              0x0000000107110c4d 0x1070d8000 + 232525
2   com.apple.Terminal              0x000000010716ebb8 0x1070d8000 + 617400
3   com.apple.UIFoundation          0x00007fff9cd20b7f -[NSAttributedString(NSAttributedStringUIFoundationAdditions) doubleClickAtIndex:inRange:] + 337
4   com.apple.AppKit                0x00007fff882aa90e -[NSAttributedString(NSAttributedStringDeprecatedKitAdditions) URLAtIndex:effectiveRange:] + 607
5   com.apple.Terminal              0x000000010717c625 0x1070d8000 + 673317
6   com.apple.Terminal              0x0000000107147f81 0x1070d8000 + 458625
7   com.apple.Terminal              0x00000001071481e9 0x1070d8000 + 459241
8   com.apple.Terminal              0x000000010714ec1c 0x1070d8000 + 486428
9   com.apple.Foundation            0x00007fff8bc42f7f __NSFireTimer + 83
10  com.apple.CoreFoundation        0x00007fff8a1b7244 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
11  com.apple.CoreFoundation        0x00007fff8a1b6ecf __CFRunLoopDoTimer + 1071
12  com.apple.CoreFoundation        0x00007fff8a1b6a2a __CFRunLoopDoTimers + 298
13  com.apple.CoreFoundation        0x00007fff8a1ae3e1 __CFRunLoopRun + 2065
14  com.apple.CoreFoundation        0x00007fff8a1ad974 CFRunLoopRunSpecific + 420
15  com.apple.HIToolbox             0x00007fff89739acc RunCurrentEventLoopInMode + 240
16  com.apple.HIToolbox             0x00007fff89739901 ReceiveNextEventCommon + 432
17  com.apple.HIToolbox             0x00007fff89739736 _BlockUntilNextEventMatchingListInModeWithFilter + 71
18  com.apple.AppKit                0x00007fff87cdfae4 _DPSNextEvent + 1120
19  com.apple.AppKit                0x00007fff8845a21f -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2789
20  com.apple.AppKit                0x00007fff87cd4465 -[NSApplication run] + 926
21  com.apple.AppKit                0x00007fff87c9ed80 NSApplicationMain + 1237
22  libdyld.dylib                   0x00007fff9f706255 start + 1

Thread 1:: com.apple.terminal.low-disk-space-handler
0   libsystem_kernel.dylib          0x00007fff9f835e2a kevent + 10
1   com.apple.Terminal              0x00000001070da3df 0x1070d8000 + 9183
2   com.apple.Foundation            0x00007fff8bbd2c6d __NSThread__start__ + 1243
3   libsystem_pthread.dylib         0x00007fff9f91daab _pthread_body + 180
4   libsystem_pthread.dylib         0x00007fff9f91d9f7 _pthread_start + 286
5   libsystem_pthread.dylib         0x00007fff9f91d1fd thread_start + 13

Thread 2:: com.apple.terminal.sigchld-handler
0   libsystem_kernel.dylib          0x00007fff9f8362da read + 10
1   com.apple.Terminal              0x00000001070e4e03 0x1070d8000 + 52739
2   com.apple.Foundation            0x00007fff8bbd2c6d __NSThread__start__ + 1243
3   libsystem_pthread.dylib         0x00007fff9f91daab _pthread_body + 180
4   libsystem_pthread.dylib         0x00007fff9f91d9f7 _pthread_start + 286
5   libsystem_pthread.dylib         0x00007fff9f91d1fd thread_start + 13

Thread 3:: com.apple.terminal.tty-io
0   libsystem_kernel.dylib          0x00007fff9f834f4a __select + 10
1   com.apple.Terminal              0x00000001070e661b 0x1070d8000 + 58907
2   com.apple.Foundation            0x00007fff8bbd2c6d __NSThread__start__ + 1243
3   libsystem_pthread.dylib         0x00007fff9f91daab _pthread_body + 180
4   libsystem_pthread.dylib         0x00007fff9f91d9f7 _pthread_start + 286
5   libsystem_pthread.dylib         0x00007fff9f91d1fd thread_start + 13

Thread 4:: com.apple.NSEventThread
0   libsystem_kernel.dylib          0x00007fff9f82d38a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff9f82c7d7 mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff8a1aec94 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff8a1ae121 __CFRunLoopRun + 1361
4   com.apple.CoreFoundation        0x00007fff8a1ad974 CFRunLoopRunSpecific + 420
5   com.apple.AppKit                0x00007fff87e2cf92 _NSEventThread + 205
6   libsystem_pthread.dylib         0x00007fff9f91daab _pthread_body + 180
7   libsystem_pthread.dylib         0x00007fff9f91d9f7 _pthread_start + 286
8   libsystem_pthread.dylib         0x00007fff9f91d1fd thread_start + 13

Thread 5:
0   libsystem_kernel.dylib          0x00007fff9f8354e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff9f91d791 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fff9f91d1ed start_wqthread + 13

Thread 6:
0   libsystem_kernel.dylib          0x00007fff9f8354e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff9f91d791 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fff9f91d1ed start_wqthread + 13

Thread 7:
0   libsystem_kernel.dylib          0x00007fff9f8354e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff9f91d791 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fff9f91d1ed start_wqthread + 13

Thread 8:
0   libsystem_kernel.dylib          0x00007fff9f8354e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff9f91d791 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fff9f91d1ed start_wqthread + 13

Thread 9:
0   libsystem_kernel.dylib          0x00007fff9f8354e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff9f91d791 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fff9f91d1ed start_wqthread + 13

Thread 10:
0   libsystem_kernel.dylib          0x00007fff9f8354e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff9f91d791 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fff9f91d1ed start_wqthread + 13

Thread 11:
0   libsystem_kernel.dylib          0x00007fff9f8354e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff9f91d5fe _pthread_wqthread + 1023
2   libsystem_pthread.dylib         0x00007fff9f91d1ed start_wqthread + 13

Thread 12:
0   libsystem_kernel.dylib          0x00007fff9f8354e2 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff9f91d791 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fff9f91d1ed start_wqthread + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00007fff58b24f0e  rbx: 0x0000610000672f80  rcx: 0x0000000000005ff2  rdx: 0x0000000000000002
  rdi: 0x00007fff58b24f0e  rsi: 0x0000000000000000  rbp: 0x00007fff58b24e70  rsp: 0x00007fff58b24e70
   r8: 0x0000000000000000   r9: 0x00007fff58b24e5c  r10: 0x00007f996715ca76  r11: 0x00007fff58b24f0e
  r12: 0x0000000000000018  r13: 0x0000000000000010  r14: 0x000000000000f136  r15: 0x000000000003e07d
  rip: 0x00007fff9f916f56  rfl: 0x0000000000010246  cr2: 0x0000000000000000

Logical CPU:     6
Error Code:      0x00000004
Trap Number:     14
like image 922
thinkski Avatar asked Jan 26 '17 00:01

thinkski


1 Answers

This is a bug in Terminal.app, possibly being fixed in 10.12.4

Lots of details are here: https://discussions.apple.com/thread/7778906

The cause seems to be related to using the alternate screen (More than you wanted to know about that: http://www.shallowsky.com/linux/noaltscreen.html)

And line wrapping.

I've found that you can reliably trigger the crash this way:

  1. Be in the alt screen (vim, screen, etc...)
  2. Create a logical line long enough to wrap to the next physical line
  3. Delete back from the end of the line until it no longer wraps.
  4. crash

The work around for now is to get a copy of Terminal.app from 10.12.0 or earlier.

The problem seems to have been introduced with Terminal.app 387 of the 10.12.1 update. I extracted version 377 from my recovery partition (also present in the original 10.12.0 installer) which copes fine with above test case.

https://discussions.apple.com/message/31417760#message31417760

like image 172
Aaron McMillin Avatar answered Nov 02 '22 13:11

Aaron McMillin