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

Mar 31, 2017 11:36 AM in response to rkcarter

Hi rkcarter, I did see the # but thought it was part of your terminal prompt. No worries!


Experimenting a bit more today, I have found that (1) the ssh is not necessary, nor the 'set -o emacs', (2) the long command can be pretty much any bit of gibberish that wraps a couple of lines, and (3) the following 'view' command DOES seem to be important. I can't make the crash happen if I substitute any other command in that spot -- probably the full screen redraw that occurs when view (i.e., vim) starts up is critical to triggering the crash?

Mar 31, 2017 11:57 AM in response to RogerDavis

That's fascinating! And today I've been having trouble reliably recreating it; I had just run OnyX and cleared all my caches and rebooted; for a bit I thought it had fixed it, but going back and forth between doing actual work and occasionally flipping over to the terminal window it did crash. I did bring up "view {somefile}" and quit it once or twice in there. I hope we can get something that the tech can reliably make happen.

Mar 31, 2017 2:28 PM in response to rkcarter

Hi all,


I think I have distilled the screen-triggered crash recipe shared here by rkcarter to the bare minimum necessary. It will run on a standalone Mac desktop without requiring ssh, and crashes very reliably for me even under the new 10.12.4 release that seems to withstand ProValid's vi-triggered crash recipe. Thanks again rkcarter for providing the starting point on this!


(1) Log in to a clean, empty desktop with nothing running (i.e., no open windows of any kind on the desktop) under a userID running the bash login shell. Start Terminal, opening a single 80-character-wide window. Do not open any other windows in Terminal, and do not open any other applications or otherwise do anything to take keyboard focus out of that one Terminal window, within which you should perform all of the following actions.


(2) Run the screen command (no command options needed) at the first bash prompt in the Terminal window:


$ screen


If you see a welcome message, just hit <RETURN> to make it go away and return you to the next bash prompt.


(3) At the second bash prompt, type any gibberish command of your choice, as long as it wraps at least two lines, i.e., is longer than about 180 characters and contains no <RETURN> characters. Use any alphabetic characters and <SPACE> to create a couple dozen words in the command:


$ jsdhf fgh sf jhsgf jhsdgf jshf jshfg jsdhfg sjdhfg sjdhfg sjdhfg sjhdfg sjhfg sdjhfg sjdhfg sjdhfg sjdhfg sjhfg sdjhfg sjdhfg sjdhfg sjhdgf jshdfg sjhdfg jsdhgf jsdfjsdhgf jshdgf jsdhgf jsdhgfsjedhfg

-bash: jsdhf: command not found


(4) Start view (i.e., vim) on a non-existent file:


$ view /tmp/xx


view will redraw the window, after it does just type the two characters


:q


(that's a colon and a small-q) followed by <RETURN> to exit the program and get the next shell prompt.


(5) Type the following command, which will fail:


$ rm /tmp/xx

rm: /tmp/xx: No such file or directory


(6) Now type the up-arrow key a few times. Terminal will very likely crash as soon as bash tries to redisplay your long-line gibberish command. Sometimes you may need to up-arrow past that command, then down-arrow a few times, etc., to cause the crash.


It does seem important that you run both the 'view' and 'rm' commands above. I suspect that the 'view' command is necessary because it triggers a full window redraw. I have no idea what purpose is served by the subsequent 'rm' command, but it does appear to be necessary to trigger the crash.

Apr 20, 2017 11:08 AM in response to brucedarkspoon

Glad to hear (well, sort of ;-> ) that this fails for you, too, brucedarkspoon. I never use screen myself, but am a heavy vi user and do not believe for one second that whatever workaround Apple implemented in 10.12.4 that patched ProValid's vi-based test case has truly fixed the problem. Terminal is still crashing due to redraws of long lines and I bet there are all kinds of ways vi can still tickle a failure path.


I am getting absolutely nowhere with the support case #100106033554 which I filed. Almost one month ago I pinged my case representative for a progress report. It took him a week to write back to me, and all he could tell me was that he was trying to find out what was happening with the fix. I have pinged him every week since then and I continue to get exactly the same answer -- he is still trying to find out what's going on. Apparently Apple only makes and sells phones, but does not use them internally (nor e-mail) to communicate useful information between their support and engineering staffs. I will keep trying.


John Henning, have you had any better luck in getting anything useful out of your case rep?

Apr 25, 2017 3:14 PM in response to john henning

Hi all,


Here is the latest from my case rep:


I received an update on the ticket that I created for you. It appears that

the last OS update was designed to address an issue that was considered

similar to yours. We have been able to successfully replicate your issue and

the information has been sent to our engineering group to develop a proper

resolution. Once again, I ask that you keep your computer up to date and I

will keep you posted as additional details become available.


As I recall we had to wait through at least two 10.12.x updates to get a patch that invalidated ProValid's test case. I wouldn't expect Apple to do much better with fixing this latest reproducible case either.

Jun 1, 2017 10:54 AM in response to john henning

"Me too" - confirming what others have said - this is still happening in 10.12.5. The remote linux system where I issue the commands that trigger it - I hadn't had an issue since 10.12.15 was officially released. So I let my guard down and started connecting to that machine in Terminal. Just had a crash, while editing a very long command line.


My personal workaround for the time being - is using XQuartz and good old xterm. Man oh man I wish Apple would take this serious and fix it. It doesn't seem like much to ask.

Jul 22, 2017 9:11 AM in response to john henning

It was reported that Sierra 10.2.x fixed a bug most complained of that vi(1) was crashing Terminal.app


It was found those not using Sierra 10.2.x can use elvis(1) instead, which is very stable - and can be found on sourceforge ready to compile for apple.


> "User impact

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


User impact of what? People responding here are not stating a clear instance of a repeatable problem.


------------------------


nvi(1) was a specific complaint found elsewhere in Communities, vi was crashing if one joined lines. Don't go back to El Capitan for Terminal - Sierra 10.1 has the known bug nvi(1) crashes Terminal - which 10.2 fixed.


Note that nvi also crashed Linux xterm and some including me say "it was designed to", because it forced people not to use xterm and use a (debian) made replacement built upon the copylefted code (one more reason i'm on an apple not an ubuntu pc, thank goodness).


I haven't heard any application crashing Terminal other than nvi(1). I used elvis(1) on versions that had the issue and elvis(1) works perfect - no crashes.


------------------------


screen(1) no, just open more terminal tabs.


screen(1) has been a huge source of "bug reports" in Linux and FreeBSD for many years. Saying Apple has a bug because screen isn't working is not appropriate.


As far as screen(1), screen has many bugs and is very old software for a special purpose, with many known bugs, difficult to make use of. It has a use but you are very unlikely to match that use up with anything your doing on today's computers. Avoid it.


The problem is people are trying to use screen in environments it was not designed to work in. (Your not attaching using serial negotiation tty, your not using a PC where a DEC VT100 had been sitting using early Unix.) In this case your using a wide character "internationally enabled / hacked" Terminal emulator, which is not the unix environment screen(1) had been used with.


Do you really need to "multiplex" terminals? Why not just open more terminal tabs? or maybe use xterm (if terminal cannot be configured, compiliing xterm and configuring likely CAN achieve the correct environment, if set up properly, only if set up). Also according to your statement you are using Terminal to ssh to Linux, and screen(1) is running on Linux not Apple: with that said, screen may not be the culprit because the (liability) is layered - it could be a crash from a linux bin that transmitts the wrong chars to apple.

Jul 22, 2017 9:31 AM in response to QuietMacFan

OFF-TOPIC


A little background on Xterm312 mentioned above. Curses was a BSD terminal emulation lib (never finished), (mark and tom) made nCurses to finish Curses, and then Xterm. Xterm supports a wide number of platforms (this does not help an Apple end user), including OS/X (not Sierra per say), and supports Tektronics (oscilliscope maker / military scope) vector graphics using 'terminals'. a quip from one Unix guru: "if i only had time to explain to people the many things terminals used to be able to that can't now do" (for example: direct control of the CPU)


X.org server is Not XEROX X-Windows compatible: X.org is designed to copy-left code but destroy any app that works with X-Windows, compatibility wise, and favor (non-usa) video cards, foreign control of code submitted, etc. Your not using X when you use X.org: it's the anti-thesis of Xfree86.


Sierra is not X or x.org anymore (says Apple, I've not verified that). My bets are that's the best thing for Apple users whether they are using the GUI or the BSD userland. X 'maintained' by hostile or (competitor) parties only becomes a forced upgrade or ransom-ware issue.


Apple should likely stop using mozilla and apache2 as well, review code they are using, and go from there adding only what code benefits apple users. I notice that Apple doesn't use the newest versions of FreeBSD utils and hopefully the reason why is careful checking of "what works" and careful removing of (malware / buggy "new" features).

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.