[R-SIG-Mac] CONFIRMED - R.app crashes at startup on MacOS Sierra

Brandon Hurr brandon.hurr at gmail.com
Thu Dec 8 17:30:13 CET 2016


Simon,

I have been experiencing this error for quite some time. If I load a r
script by double clicking it, it happens nearly 100% of the time. If I
load R itself first then it doesn't happen. If I clear the "recent"
files area it doesn't happen until I fill it again. The file opened
seems irrelevant, as does the location of the file (admittedly, all in
user space or external drives).

Despite the dire warning, if I hit escape I can continue working
nearly indefinitely without issue (my script save rate increases to
compensate for risk).

This was reported by CW on Nov 4th (perhaps others before), email
entitled: "[R-SIG-Mac] R segfault at startup, causing R crash". I
worked a little bit with Kevin Ushey offline to get to the bottom of
it further and I thought he pinned it down or at least got closer to
the cause.

"
After playing around with R.app for a bit, I was able to get myself
into a state where R.app was either dying or hanging on startup. I did
the following:

   1. Open R.app,
   2. Open a new R document (using the icon in the top menu bar --
'Create a new, empty document in the editor' ),
   3. Write and execute some code -- in my case, 'x <- 1; print(x)',
executed with Cmd + Enter,
   4. (optionally) Repeat steps 2 and 3, creating new documents and
executing more code,
   5. Focus a different application,
   6. Attempt to open an R document (using the menu bar again --
'Source script or load data in R',
   7. Observe that R.app is now hanging.

Note that if you run these repro steps, you may see R segfault / die
on startup (although in some cases all was fine). Note that step 5 is
necessary (IIUC) to force R.app to attempt to save the application
state.

It looks like R.app stores session state in the folder

    ~/Library/Saved Application State/org.R-project.R.savedState

My hypothesis at this point is that this saved state is somehow
getting corrupted. Removing that folder seems to resolve any startup
crashes I see.

As for the 'Open File' dialog hang, here's what I believe are the
relevant bits of an lldb stack trace I see:

 * frame #0: 0x00007fffce2a7cba libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x00007fffce390f6a
libsystem_pthread.dylib`_pthread_mutex_lock_wait + 100
    frame #2: 0x00007fffc573faee
FinderKit`+[FI_TFloatingInputWindowController singleton] + 34
    frame #3: 0x00007fffc57edd5b FinderKit`-[FI_TBrowserTableView
inputContext] + 29
    frame #4: 0x00007fffb6d397dc AppKit`+[NSTextInputContext
currentInputContext] + 145
    frame #5: 0x00007fffb6e7a272 AppKit`+[_NSAutomaticFocusRing
setActiveFirstResponderChanged] + 37
    frame #6: 0x00007fffb6e7a1d9
AppKit`___NSPostActiveFirstResponderChanged_block_invoke + 29
    frame #7: 0x00007fffb90cdec7
CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
+ 23
    frame #8: 0x00007fffb90cde37 CoreFoundation`__CFRunLoopDoObservers + 391
    frame #9: 0x00007fffb90aead9 CoreFoundation`__CFRunLoopRun + 873
    frame #10: 0x00007fffb90ae514 CoreFoundation`CFRunLoopRunSpecific + 420
    frame #11: 0x00007fffbaaabcb2 Foundation`-[NSRunLoop(NSRunLoop)
runMode:beforeDate:] + 277
    frame #12: 0x000000010b21f43e R`-[RDocumentWinCtrl
setStatusLineText:](self=0x00006180001e7c00,
_cmd="setStatusLineText:", text=@"print(x, ...)") + 910 at
RDocumentWinCtrl.m:465
    frame #13: 0x000000010b21f03d R`-[RDocumentWinCtrl
RDocumentDidResize:](self=0x00006180001e7c00,_cmd="RDocumentDidResize:",
notification=@"NSWindowDidResizeNotification") + 77 at
RDocumentWinCtrl.m:431

with context from frame 12:

frame #12: 0x000000010b21f43e R`-[RDocumentWinCtrl
setStatusLineText:](self=0x00006180001e7c00,
_cmd="setStatusLineText:", text=@"print(x, ...)") + 910 at
RDocumentWinCtrl.m:465
   462          [statusLine setStringValue:text];
   463          [statusLine setNeedsDisplay:YES];
   464          // Run NSDefaultRunLoopMode to allow to update status line
-> 465          [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
   466
beforeDate:[NSDate distantPast]];
   467
   468  }

Hopefully this helps...

Best,
Kevin
"

B

On Thu, Dec 8, 2016 at 6:28 AM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
> Karl,
>
> unfortunately I cannot reproduce it on 10.12.1. How exactly can you trigger it? I have tried dragging a file on the R icon and open -a /Applications/R.app test.R and neither crashed on me. Does it depend on the R file opened or its location?
>
> Rainer,
> it seems that your build is broken - I have seen crashes on error in builds that don't compile longjmp correctly so errors blow up the event loop - which seems to be the case in your build. How did you build it?
>
> Cheers,
> Simon
>
>
>
>> On Dec 8, 2016, at 5:45 AM, Rainer M Krug <Rainer at krugs.de> wrote:
>>
>> Karl Thomaseth <karl.thomaseth at gmail.com> writes:
>>
>>> Hello all,
>>>
>>> I regret to bother you, but since I upgraded to MacOS Sierra more than a month ago, I am experiencing
>>> that whenever I open any “file.R”, which launches automatically R.app GUI the GUI crashes (see info below),
>>> I removed also all .RData and .Rapp.history from my system with
>>> sudo find / -name “.RData” -delete
>>> sudo find / -name “.Rapp*” -delete
>>> If I start R directly from the Dock, everything works fine.
>>
>> First attempt: Nope - works. Then I realized it opened in emacs...
>>
>> OK.
>>
>> Opening a .R file via clicking on it actually results in the crash as
>> well. The file is opened, but R crashes.
>>
>>
>> How did you install R? I installed via homebrew (And no, I don't expect
>> any help here for my case).
>>
>> But I might add: maybe related - but R crashes in the GUI if I use
>> e.g. a non-existing function - maybe related?
>>
>> ,----
>> | > version
>> |                _
>> | platform       x86_64-apple-darwin16.1.0
>> | arch           x86_64
>> | os             darwin16.1.0
>> | system         x86_64, darwin16.1.0
>> | status
>> | major          3
>> | minor          3.2
>> | year           2016
>> | month          10
>> | day            31
>> | svn rev        71607
>> | language       R
>> | version.string R version 3.3.2 (2016-10-31)
>> | nickname       Sincere Pumpkin Patch
>> | > version()
>> | Error: could not find function "version"
>> |
>> |  *** caught segfault ***
>> | address 0x18, cause 'memory not mapped'
>> |
>> | Possible actions:
>> | 1: abort (with core dump, if enabled)
>> | 2: normal R exit
>> | 3: exit R without saving workspace
>> | 4: exit R saving workspace
>> | Selection:
>> `----
>>
>> Cheers,
>>
>> Rainer
>>
>>>
>>> Thank you
>>>
>>> Karl Thomaseth
>>>
>>>
>>>
>>> R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
>>> Copyright (C) 2016 The R Foundation for Statistical Computing
>>> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>>>
>>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>>> You are welcome to redistribute it under certain conditions.
>>> Type 'license()' or 'licence()' for distribution details.
>>>
>>> Natural language support but running in an English locale
>>>
>>> R is a collaborative project with many contributors.
>>> Type 'contributors()' for more information and
>>> 'citation()' on how to cite R or R packages in publications.
>>>
>>> Type 'demo()' for some demos, 'help()' for on-line help, or
>>> 'help.start()' for an HTML browser interface to help.
>>> Type 'q()' to quit R.
>>>
>>> [R.app GUI 1.68 (7288) x86_64-apple-darwin13.4.0]
>>>
>>> *** caught segfault ***
>>> address 0x7f8bf2637f8, cause 'memory not mapped'
>>>
>>> Possible actions:
>>> 1: abort (with core dump, if enabled)
>>> 2: normal R exit
>>> 3: exit R without saving workspace
>>> 4: exit R saving workspace
>>>>
>>> Selection:
>>>
>>> =======================================
>>>> sessionInfo()
>>> R version 3.3.2 (2016-10-31)
>>> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>>> Running under: macOS Sierra 10.12.1
>>>
>>> locale:
>>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>>
>>> attached base packages:
>>> [1] stats graphics grDevices utils datasets methods base
>>>>
>>>
>>>
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>
>>
>> --
>> Rainer M. Krug
>> email: Rainer<at>krugs<dot>de
>> PGP: 0x0F52F982
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list