[R-SIG-Mac] R segfault at startup, causing R crash
C W
tmrsg11 at gmail.com
Tue Nov 8 18:30:01 CET 2016
I was wondering if anyone on the core r-sig-mac developer's group has a fix
to this.
For now, I can get by with RStudio, but to be honest, I like the native R,
very used to it. Thanks!
On Sun, Nov 6, 2016 at 1:58 AM, Kevin Ushey <kevinushey at gmail.com> wrote:
> 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
>
> ---
>
> 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)
> macOS Sierra -- Version 10.12.1
>
> On Sat, Nov 5, 2016 at 5:08 PM, Kevin Ushey <kevinushey at gmail.com> wrote:
> > It might be worth trying to launch R with lldb attached. You can run
> > the following command from the terminal:
> >
> > /usr/bin/lldb -w -n R
> >
> > Then, try launching R (or R.app) -- 'lldb' should then detect that R
> > has been launched, and you can enter 'c' in the 'lldb' terminal window
> > to continue execution. Once R crashes / segfaults, you should
> > hopefully get a nice backtrace that may provide some actionable
> > information on how the bug could be fixed. The backtrace can normally
> > be printed using 'bt' in the lldb console. If lucky, that backtrace
> > should show exactly what code is causing the crash, and could give
> > some hints on how the crash could be resolved.
> >
> > If you're not familiar with lldb, http://lldb.llvm.org/tutorial.html
> > gives a nice tutorial.
> >
> > Best,
> > Kevin
> >
> > On Sat, Nov 5, 2016 at 8:55 AM, C W <tmrsg11 at gmail.com> wrote:
> >> Hi Bryan,
> >>
> >> Right after I wrote the email, I restarted R and the problem came
> back. I
> >> guess I jinx-ed my luck. ;)
> >>
> >> The funny thing is, I did not even have a Rscript, it was just the stand
> >> alone R console. I was actually using it as a calculator.
> >>
> >> I always thought OS X is more compatible with R than Windows, who
> knows. :(
> >>
> >> On Sat, Nov 5, 2016 at 11:47 AM, Bryan Hanson <hanson at depauw.edu>
> wrote:
> >>
> >>> No problem, glad to try to help.
> >>>
> >>> There probably isn’t a problem with R.gui itself (when you “run R” on a
> >>> Mac by clicking the icon you are causing your computer to actually run
> the
> >>> R.gui which in turn is running R under the hood).
> >>>
> >>> So if the problem re-occurs, note the name of the most recent file (it
> >>> probably was opened when you launched R prior to R faulting). Then
> find
> >>> that file and change the extension (temporarily). Then try to launch R
> >>> again and I expect it will not have a problem.
> >>>
> >>> Bryan
> >>>
> >>> > On Nov 5, 2016, at 11:43 AM, C W <tmrsg11 at gmail.com> wrote:
> >>> >
> >>> > Hi Bryan,
> >>> >
> >>> > I appreciate your detailed explanation. I am not an R expert, I do
> not
> >>> know how to fix the R.gui you mentioned.
> >>> >
> >>> > I kept on opening and closing R, after a dozen tries, the error went
> >>> away temporarily. I still get the error, but it was not every time.
> >>> >
> >>> > Since then, I have upgraded to R version 3.3.2 (2016-10-31).
> >>> >
> >>> > I think this problem may come back, please let me know when you find
> a
> >>> solution. Thank you!
> >>> >
> >>> > On Fri, Nov 4, 2016 at 8:28 PM, Bryan Hanson <hanson at depauw.edu>
> wrote:
> >>> > Sorry, I should add that when you rename the offending file you need
> to
> >>> change its extension, otherwise R will follow the file.
> >>> >
> >>> > >>> Original Message:
> >>> >
> >>> > I had something similar earlier this week (also on Sierra). I was in
> >>> touch with Simon who suggested it might be a bad workspace image, so
> you
> >>> can try to remove any .RData or .rda files. However, in my case it
> was not
> >>> that (I don’t save workspace images or histories for that matter).
> But I
> >>> removed all of those from my entire computer anyway and the problem
> >>> remained (a few were left on shared drives by others who were saving
> >>> workspace images).
> >>> >
> >>> > Ultimately I was able to trace the problem to something being wrong
> with
> >>> the “recent” list. In my case R.gui was trying to open the most recent
> >>> file in the list, but something about the link to it was corrupted. I
> >>> verified this by running R from the command line and sourcing the file
> that
> >>> seemed to be associated with the crash. It worked fine, so the file
> was
> >>> not the problem.
> >>> >
> >>> > So, here’s what worked for me: When R.gui is asking you for a
> >>> “selection” to close down, see if the File -> Open Recent… option can
> still
> >>> be selected, and if so, go all the way down to the clear menu item.
> Once
> >>> this list of recently opened files was empty, R.gui ran fine. In my
> case
> >>> not all files would clear from the list. There was one left, and it
> was
> >>> the one apparently causing the problem. I renamed it so R.gui
> couldn’t use
> >>> it/find it, and then the problem was gone. Again, there was nothing
> wrong
> >>> with the file, there was something wrong with the “remembering”.
> >>> >
> >>> > A few days later, I had to repeat this process when the problem
> >>> re-occurred. There may be something genuinely conflicted between
> Sierra
> >>> and R.gui, only time will tell. If it proves to be a widespread
> problem
> >>> more observations should help narrow it down. But this is what I
> >>> experienced and how I fixed it.
> >>> >
> >>> > Bryan
> >>> >
> >>> >
> >>> > > On Nov 4, 2016, at 7:31 PM, C W <tmrsg11 at gmail.com> wrote:
> >>> > >
> >>> > > Dear R list,
> >>> > >
> >>> > > Every time I start R, the following error message come up:
> >>> > >
> >>> > > *** caught segfault ***
> >>> > > address 0x0, cause 'unknown'
> >>> > >
> >>> > > 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:
> >>> > >
> >>> > >
> >>> > > Sometimes I get this error message instead,
> >>> > >
> >>> > > 2016-11-04 16:50:08.446 R[23372:326103] -[NSDrawerWindow
> >>> > > setRuleThickness:]: unrecognized selector sent to instance
> >>> 0x7fabc94a74b0
> >>> > > 2016-11-04 16:50:08.454 R[23372:326103] *** RController: caught
> ObjC
> >>> > > exception while processing system events. Update to the latest GUI
> >>> version
> >>> > > and consider reporting this properly (see FAQ) if it persists and
> is
> >>> not
> >>> > > known.
> >>> > > *** reason: -[NSDrawerWindow setRuleThickness:]: unrecognized
> selector
> >>> sent
> >>> > > to instance 0x7fabc94a74b0
> >>> > > *** name: NSInvalidArgumentException, info: (null)
> >>> > > *** Version: R 3.3.2 (71607) R.app R 3.3.2 GUI 1.68 Mavericks build
> >>> > > Consider saving your work soon in case this develops into a
> problem.
> >>> > > Here's the sessionInfo(),
> >>> > >
> >>> > >> 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
> >>> > > [7] base
> >>> > >
> >>> > >
> >>> > > I would appreciate any help, thank you!
> >>> > >
> >>> > > [[alternative HTML version deleted]]
> >>> > >
> >>> > > _______________________________________________
> >>> > > R-SIG-Mac mailing list
> >>> > > R-SIG-Mac at r-project.org
> >>> > > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> >>> >
> >>> >
> >>>
> >>>
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> _______________________________________________
> >> R-SIG-Mac mailing list
> >> R-SIG-Mac at r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
[[alternative HTML version deleted]]
More information about the R-SIG-Mac
mailing list