Vim the editor keeps crashing on Sierra
I love using Vim through Terminal.app. Everything was fine until three days ago, when Vim starts to crashing. Each crash happens when I enter a newline('\n'
) character in the Edit Mode, but not every newline character entered would trigger a crash. Normally this happens once or twice a day.
For the full error report, see this gist.
Process: Terminal [23533]
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 [23533]
User ID: 501
Date/Time: 2017-01-19 21:54:30.872 +0800
OS Version: Mac OS X 10.12.2 (16C67)
Report Version: 12
Anonymous UUID: FEDD969A-EA4B-329C-0B62-F0C04462CC4D
Sleep/Wake UUID: C240156F-812D-4924-99DD-AF87AC1F5A65
Time Awake Since Boot: 160000 seconds
Time Since Wake: 10000 seconds
System Integrity Protection: disabled
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 000000010c37b000-000000010c44b000 [ 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 0x00007fffe5d2cf56 _platform_memmove$VARIANT$Haswell + 182
1 com.apple.Terminal 0x000000010c3b3c4d 0x10c37b000 + 232525
2 com.apple.Terminal 0x000000010c411bb8 0x10c37b000 + 617400
3 com.apple.UIFoundation 0x00007fffe3136b7f -[NSAttributedString(NSAttributedStringUIFoundationAdditions) doubleClickAtIndex:inRange:] + 337
4 com.apple.AppKit 0x00007fffce6c090e -[NSAttributedString(NSAttributedStringDeprecatedKitAdditions) URLAtIndex:effectiveRange:] + 607
5 com.apple.Terminal 0x000000010c41f625 0x10c37b000 + 673317
6 com.apple.Terminal 0x000000010c3eaf81 0x10c37b000 + 458625
7 com.apple.Terminal 0x000000010c3eb1e9 0x10c37b000 + 459241
8 com.apple.Terminal 0x000000010c3f1c1c 0x10c37b000 + 486428
9 com.apple.Foundation 0x00007fffd2058f7f __NSFireTimer + 83
10 com.apple.CoreFoundation 0x00007fffd05cd244 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
11 com.apple.CoreFoundation 0x00007fffd05ccecf __CFRunLoopDoTimer + 1071
12 com.apple.CoreFoundation 0x00007fffd05cca2a __CFRunLoopDoTimers + 298
13 com.apple.CoreFoundation 0x00007fffd05c43e1 __CFRunLoopRun + 2065
14 com.apple.CoreFoundation 0x00007fffd05c3974 CFRunLoopRunSpecific + 420
15 com.apple.HIToolbox 0x00007fffcfb4facc RunCurrentEventLoopInMode + 240
16 com.apple.HIToolbox 0x00007fffcfb4f901 ReceiveNextEventCommon + 432
17 com.apple.HIToolbox 0x00007fffcfb4f736 _BlockUntilNextEventMatchingListInModeWithFilter + 71
18 com.apple.AppKit 0x00007fffce0f5ae4 _DPSNextEvent + 1120
19 com.apple.AppKit 0x00007fffce87021f -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2789
20 com.apple.AppKit 0x00007fffce0ea465 -[NSApplication run] + 926
21 com.apple.AppKit 0x00007fffce0b4d80 NSApplicationMain + 1237
22 libdyld.dylib 0x00007fffe5b1c255 start + 1
Thread 1:: com.apple.terminal.low-disk-space-handler
0 libsystem_kernel.dylib 0x00007fffe5c4be2a kevent + 10
1 com.apple.Terminal 0x000000010c37d3df 0x10c37b000 + 9183
2 com.apple.Foundation 0x00007fffd1fe8c6d __NSThread__start__ + 1243
3 libsystem_pthread.dylib 0x00007fffe5d33aab _pthread_body + 180
4 libsystem_pthread.dylib 0x00007fffe5d339f7 _pthread_start + 286
5 libsystem_pthread.dylib 0x00007fffe5d331fd thread_start + 13
Thread 2:: com.apple.terminal.sigchld-handler
0 libsystem_kernel.dylib 0x00007fffe5c4c2da read + 10
1 com.apple.Terminal 0x000000010c387e03 0x10c37b000 + 52739
2 com.apple.Foundation 0x00007fffd1fe8c6d __NSThread__start__ + 1243
3 libsystem_pthread.dylib 0x00007fffe5d33aab _pthread_body + 180
4 libsystem_pthread.dylib 0x00007fffe5d339f7 _pthread_start + 286
5 libsystem_pthread.dylib 0x00007fffe5d331fd thread_start + 13
Thread 3:: com.apple.terminal.tty-io
0 libsystem_kernel.dylib 0x00007fffe5c4af4a __select + 10
1 com.apple.Terminal 0x000000010c38961b 0x10c37b000 + 58907
2 com.apple.Foundation 0x00007fffd1fe8c6d __NSThread__start__ + 1243
3 libsystem_pthread.dylib 0x00007fffe5d33aab _pthread_body + 180
4 libsystem_pthread.dylib 0x00007fffe5d339f7 _pthread_start + 286
5 libsystem_pthread.dylib 0x00007fffe5d331fd thread_start + 13
Thread 4:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x00007fffe5c4338a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fffe5c427d7 mach_msg + 55
2 com.apple.CoreFoundation 0x00007fffd05c4c94 __CFRunLoopServiceMachPort + 212
3 com.apple.CoreFoundation 0x00007fffd05c4121 __CFRunLoopRun + 1361
4 com.apple.CoreFoundation 0x00007fffd05c3974 CFRunLoopRunSpecific + 420
5 com.apple.AppKit 0x00007fffce242f92 _NSEventThread + 205
6 libsystem_pthread.dylib 0x00007fffe5d33aab _pthread_body + 180
7 libsystem_pthread.dylib 0x00007fffe5d339f7 _pthread_start + 286
8 libsystem_pthread.dylib 0x00007fffe5d331fd thread_start + 13
Thread 5:
0 libsystem_pthread.dylib 0x00007fffe5d331e0 start_wqthread + 0
1 ??? 0x6e69740000000000 0 + 7956017760075513856
Thread 6:
0 libsystem_kernel.dylib 0x00007fffe5c4b4e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fffe5d33791 _pthread_wqthread + 1426
2 libsystem_pthread.dylib 0x00007fffe5d331ed start_wqthread + 13
Thread 7:
0 libsystem_pthread.dylib 0x00007fffe5d331e0 start_wqthread + 0
1 ??? 0x000000010c496000 0 + 4501102592
Thread 8:
0 libsystem_kernel.dylib 0x00007fffe5c4b4e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fffe5d335fe _pthread_wqthread + 1023
2 libsystem_pthread.dylib 0x00007fffe5d331ed start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fff53881f0e rbx: 0x000060000067d440 rcx: 0x000000000000ebb5 rdx: 0x0000000000000002
rdi: 0x00007fff53881f0e rsi: 0x0000000000000000 rbp: 0x00007fff53881e70 rsp: 0x00007fff53881e70
r8: 0x0000000000000000 r9: 0x00007fff53881e5c r10: 0x00007f82dd284c30 r11: 0x00007fff53881f0e
r12: 0x0000000000000018 r13: 0x0000000000000010 r14: 0x000000000000e22b r15: 0x000000000003edb0
rip: 0x00007fffe5d2cf56 rfl: 0x0000000000010246 cr2: 0x0000000000000000
Logical CPU: 0
Error Code: 0x00000004
Trap Number: 14
Binary Images:
0x10c37b000 - 0x10c44aff7 com.apple.Terminal (2.7.1 - 388) <3C674CD2-E649-3684-883C-A3A0B01DF572> /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
0x110305000 - 0x110325fff com.apple.CoreNLP (1.0 - 78.2) <D7A0704A-C4EB-3225-9F23-A06EC3318238> /System/Library/PrivateFrameworks/CoreNLP.framework/Versions/A/CoreNLP
0x11039d000 - 0x1103a1fff com.apple.audio.AppleHDAHALPlugIn (278.56 - 278.56) <BB9CA0DC-D58F-39C4-91C9-79B74666DF31>
......
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 29
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 78111
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=263.0M resident=0K(0%) swapped_out_or_unallocated=263.0M(100%)
Writable regions: Total=167.3M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=167.3M(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Accelerate framework 256K 3
Activity Tracing 256K 2
CG backing stores 1172K 4
CG image 244K 16
CoreAnimation 16K 4
CoreUI image data 784K 9
CoreUI image file 288K 6
Foundation 20K 3
Image IO 204K 9
Kernel Alloc Once 8K 2
MALLOC 136.0M 53
MALLOC guard page 48K 10
Memory Tag 242 12K 2
STACK GUARD 56.0M 10
Stack 12.1M 10
VM_ALLOCATE 104K 16
__DATA 23.8M 231
__GLSLBUILTINS 2588K 2
__IMAGE 528K 2
__LINKEDIT 113.5M 9
__TEXT 149.6M 234
__UNICODE 556K 2
mapped file 160.0M 27
shared memory 16.4M 14
=========== ======= =======
TOTAL 674.2M 656
Model: MacBookAir7,2, BootROM MBA71.0166.B12, 2 processors, Intel Core i5, 1.6 GHz, 4 GB, SMC 2.27f2
Graphics: Intel HD Graphics 6000, Intel HD Graphics 6000, Built-In
Memory Module: BANK 0/DIMM0, 2 GB, DDR3, 1600 MHz, 0x80AD, 0x483943434E4E4E384A544D4C41522D4E544D
Memory Module: BANK 1/DIMM0, 2 GB, DDR3, 1600 MHz, 0x80AD, 0x483943434E4E4E384A544D4C41522D4E544D
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x117), Broadcom BCM43xx 1.0 (7.21.171.68.1a4)
Bluetooth: Version 5.0.2f4, 3 services, 17 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM0128G, 121.33 GB
USB Device: USB 3.0 Bus
USB Device: Ultra
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
Thunderbolt Bus: MacBook Air, Apple Inc., 27.2
It is failing reliably for me too. For me it only happens with vim running on a remote machine using ssh. Vim does seem to be the common factor.
According to this Google groups thread, the problem can be reproduced by putting this into a file:
/goldbaum2-7.bmv already exists; use -y to recreate
/des_surveyBuildup_11-7.bmv already exists; use -y to recreate
/lsst_telescope12-22.bmv 1-2660 /fe0/deslsst/telescope/comps/lsst_obj_12-22_comp4k/lsst_obj_12-22_comp4k.%04d.png
img2bmv -f 30 -p 3 -N 6 -L 42 -t 512x360 -w 4096x2160 -w 3840x2160 -t 480x540 -o /fraid0/movies/ren400My_vars_grids_labels_11-8.bmv 1-2881 /fe0/deslsst/renaissance/comps/ren400My_vars_grids_labels_3840_11-8/ren400My_vars_grids_labels_3840_11-8.%04d.png
Don't know how to make these movies: -f 3
Then editing it with vim and executing the command sequence 3jdfo
. This reproduces the problem for me.
This is clearly a bug in Terminal.app's handling of an escape sequence generated by vim. Hopefully there will be a fix in the next OSX update.
Update: I have also seen the problem with command-line history editing with zsh
in vi mode. Clearly a problem in Terminal.app.
Update 2: The test case no longer crashes Terminal.app after the 10.12.4 update. Solution: Update to 10.12.4.
Using Sierra 10.12.3 and macvim installed via macports, I do not get crashes, per se, when running macvim through the Terminal.app, but it is incredibly "laggy". In particular, switching focus back and forth between the macvim window and any Terminal.app window can take up to a minute.
Someone in another thread on nabble claimed that the crashes with vim can be avoided by declaring Terminal.app to be anything other than xterm, xterm-16, or xterm-256. That might fix the crash problem but it does not help with the sluggishness I am experiencing.