You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Terminal.app crashing: Can I disable callbacks?

Five times in the last 48 hours, Terminal.app "quit unexpectedly". The Terminal_datestamp.crash files show

EXC_BAD_ACCESS (SIGSEGV) KERN_INVALID_ADDRESS at 0x0000000000000000

with a call stack that always includes:

com.apple.Terminal 0x000000010530bc94 0x105295000 + 486548 com.apple.Foundation 0x00007fff972ac5df __NSFireTimer + 83 com.apple.CoreFoundation 0x00007fff95837d74 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 com.apple.CoreFoundation 0x00007fff958379ff __CFRunLoopDoTimer + 1071 com.apple.CoreFoundation 0x00007fff9583755a __CFRunLoopDoTimers + 298 com.apple.CoreFoundation 0x00007fff9582ef81 __CFRunLoopRun + 2065

User impact

I cannot use the system: must find solution, even if the cost is to wipe disk and install previous OS (El Capitan).

The primary question

(q1) Is there some new feature of Sierra that integrates Terminal with other apps that can be turned off, perhaps a setting to disable callbacks?

Secondary questions

  • (q2) Can I potentially run a copy of the Terminal.app from a previous version of Mac OS X? Prior to my new laptop (and Sierra) these crashes never happened.
  • (q3) What additional detail would be useful, and how can I collect it?

    I am familiar with Unix application development, but not for Mac OS X. I am happy to collect additional detail by turning on debug tools, traces, event collectors, etc. but would need pointers to get started. Xcode is available, but I would be a beginner with it.

System summary

  • New MacBook Pro (Retina, 15-inch, Mid 2015).
    • Arrived 6 days ago.
    • (Yes, I intentionally bought a brand-new instance of the previous model.)
    • Surprisingly, it arrived with Sierra. It presently has 10.12.1
    • Xcode installed
    • GCC 6.2.0 available, built locally.
  • Previous history brought in by Migration Assistant
  • Not tried (yet, anyway)
    • I have briefly visited safe mode but have not stayed there. I do not know whether there would be crashes of Terminal.app if I spent all day in safe mode
    • I do not know whether there would be crashes if I created a fresh, different user account.
  • Tentative rule-outs:
    • Malware, adware, etc are reasonably unlikely given the usage pattern for this work system: firewalls in sw and hw, no visiting of dicey websites, primary application used all day long is vim.
    • However, if Terminal is now integrated with the world wide web then I suppose anything is possible.

MacBook Pro with Retina display, macOS Sierra (10.12.1)

Posted on Dec 8, 2016 7:06 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 19, 2017 4:53 AM

Heya!


This problem's been bugging me as well and with the information from this thread I narrowed it down to the following:


Stuart's test case can be simplified to the following:

  1. Open vim an enter three lines of arbitrary text such as this:
    a
    a aaaaaaaaaaaaaaaaa
    a
    - First and third line just have to be present - no idea why.
    - The second line needs to have a space as the second character and wrap exactly one character to the next line.
    User uploaded file
  2. Delete the first character of the second line by pressing x so that now the line starts with a space and the last character of the line moves to the last column of the terminal.
    User uploaded file
  3. Wait about a second and Terminal.app will crash.


This suggests that Terminal.app has for some reason problems with lines that start with a space and end on the last column of the terminal.


It also only seems to relate with redrawing of the screen because I was not able to reproduce it with echo commands from the command line and I have only ever seen it with full-screen terminal applications like vim and screen, running both locally and remotely.


I had a suspicion it was related to the alternate screen which both vim and screen use by default. I was able to rule that out by setting TERM=vt100 to disable use of the alternate screen and still being able to trigger the crash as described above.


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.


The obvious difference between both versions when diff'ing output of the strings command on both executables it the additon of Touchbar functionality mostly relating to man page interaction. I was not able to find any knob to disable this functionality to further narrow down the cause.


Thanks everyone for their research, providing a simple and reproducible test case and the workaround of going back to version 377 for now,

Michael

193 replies

Jan 6, 2017 12:18 PM in response to RogerDavis

FYI all, here is the latest feedback (today) on my support case from Apple:


The issue is currently being investigated and data

that you submitted is going to be helpful in providing a solution to the

issue. There is no current workaround or timeframe for a fix, but I will be

following this issue for any updates. We can expect to see a solution come

in the form of a software update so I ask that you keep your computer up to

date and if notice any changes or additional concerns to this issue that you

please let me know, so that I can inform our programmers.


My interpretation of that is we will hopefully see a fix in an upcoming Sierra update, but hard to say when.


Thanks again to all here for the discussions and detective work leading to the crash recipe that Apple is presumably now focused on with their debugging!

Jan 9, 2017 2:47 PM in response to john henning

I just tested this script in the latest (3rd release) beta for 10.12.3 and it still crashes. I now have a spare Air on which I can test this as soon as betas come out. Obviously it will take some bit of time for these reports to Apple to make it into a fix. Hopefully this is sooner than later. I plan on testing this as soon as betas are bumped and released going forward.

Jan 17, 2017 8:48 PM in response to john henning

I am seeing this issue on MacBook Pro. Crashed many times in the last hour running vim in Terminal while using ssh. I updated to latest vim from Homebrew, and still saw the problem. The new vim reports itself as version 8.0. I did not build from source. macOS version is 10.12.2.


Possibly Terminal is crashing more frequently recently because I've been running vim on files with very long lines.


I need this setup to get my work done. For now I guess I'll switch to iTerm2.


I'm glad I'm not the only one with the problem. Thanks to all.

Jan 25, 2017 8:53 PM in response to usbpaul

Hi all,


Given the recent 10.12.3 release that fails to fix the problem, I pinged my Apple support case POC again yesterday. The reply to my query as to exactly what progress Apple has made, if any:


I cannot give you specifics on the issue but I can tell you that we have

received multiple reports of the issue which have been escalated to our

engineering team. We have to wait for them to research the issue, design a

solution and make it available to the public.


Hard to tell from this if they've done anything other than let the bug reports pile up. Maybe, and maybe not.


I continue to encourage all of you fellow sufferers out there who have AppleCare or any other support contract to file your own bug reports, cross-referencing at least the original caseID #100085116387 that John Henning created on 12/8/16. (John, have you had any contact of interest on that case?)

Jan 26, 2017 10:51 AM in response to Boyd Porter

Adding a "me too" so I can follow this thread. I only recently upgraded to Sierra on just one machine where my Mac is little more than a dumb terminal to my Linux servers. What could possibly go wrong? Then my Terminal windows mysteriously go away. I guess I'm afflicted by the same bug. I will start testing it once I don't have these long-running scripts to worry about.

Jan 26, 2017 6:04 PM in response to john henning

Let me make things clear.


The crash happens *not in vim*, but in Terminal.app itself.


You can confirm this by following steps:


1. Open a Terminal.app window

2. Invoke `/usr/bin/screen`

3. In the screen session, invoke `/usr/bin/vim`

4. Use the reproducer to make a crash happen

5. Open another(new) terminal window

6. Invoke `/usr/bin/screen -r` to reattach to the last (detached by the crash) session

7. Vim is there running happily

Jan 31, 2017 5:28 PM in response to john henning

Plus 1 for this problem. My situation:

Macbook Pro Early 2011

Fresh install of Sierra went straight to 10.12.2

Data migration from my El Cap time machine backup.

Immediately saw the problem, and it's still there with 10.12.3


I don't use vim very much locally. Like others on this thread, I ssh (over VPN) and use a remote vi (vim 7.3.2035 running on Solaris 11.3 x86). I haven't looked back through my stack traces to compare them in detail, but the traces posted here are very familiar. I can go extended periods of time without Terminal.app crashing, but heavy vi usage does trigger the behavior.


I haven't seen bash command line editing (or command output for that matter) cause the problem. Like others with automatic fingers, I don't know exactly what causes it, but my observation is that it is related to editing long lines (i.e. ones that wrap around the 80 character terminal width I use). My gut instinct is that I agree with others who have already suggested that this is terminal emulation related.


Thank you to John and others for such thorough research here. I'll likely copy an El Cap version of Terminal from a backup if this doesn't get fixed soon.

Feb 2, 2017 7:02 PM in response to john henning

Just to chime in that I am having the exact problem, rather more nastily. My terminal sometimes becomes absolutely unusable, crashes as many as every 3/4 lines of typing. It only crashes when I am typing, not when its idle. No vim, emacs or anything...just bash commands. Apple needs to fix this immediately. I feel like my problem is worsening with time.

Feb 3, 2017 7:50 AM in response to Drew Reece

All of the reports seem center around strings that are too long/too fast coming in to terminal, regardless of source. An "x" in bash causes terminal to receive 3 characters from bash (backspace-space-backspace) to visually erase the character. The back feed is even higher if you have done "set -o vi" in bash. If you get a high repeat rate going for "x", then you got 3x that amount of chars coming back fast, which does seem to be lethal. Early in this thread there were test cases submitted to Apple. If you have Applecare, you should be able to tack yourself onto that original ticket, even if just by making a new one and cross referencing the original. If you're not covered by Applecare then you can't register interest in the ticket as far as I know.


I've switched to iterm2 from iterm2.com. It took some time to get the iterm2 settings they way I was used to them being with Apple's terminal app, but iterm2 works flawlessly for me. You might give iterm2 a try as a workaround.

Terminal.app crashing: Can I disable callbacks?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.