R encountered a fatal error.The session was terminated

Error Information: R encountered a fatal error.The session was terminated

Description of issue -
I am trying to run an rfsrc code in R studio but i keep getting this error. R encountered a fatal error.The session was terminated

I have tried to restart my computer, reinstall both R and RStudio and followed the guide given here https://support.rstudio.com/hc/en-us/articles/200488508-RStudio-Desktop-Will-Not-Start , but the problem still persists.
I have also tried https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State but i still get the same error. Any help please. Thank you.

System Information:

  • RStudio Edition: RStudio Desktop
  • RStudio Version: 1.2.1335
  • OS Version: Windows 10 64-bit OS 1803
  • R Version: 3.6.0
  • Output your diagnostics report (if possible):
    [1] "1.2.1335"

$R
[1] "C:\PROGRA~1\R\R-36~1.0\bin\x64\R.exe"

$pdflatex
[1] "C:\Users\WIKON\AppData\Local\Programs\MIKTEX~1.9\miktex\bin\x64\pdflatex.exe"

$bibtex
[1] "C:\Users\WIKON\AppData\Local\Programs\MIKTEX~1.9\miktex\bin\x64\bibtex.exe"

$gcc
[1] ""

$git
[1] ""

$svn
[1] ""

R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252

attached base packages:
[1] grid stats graphics grDevices utils datasets methods base

other attached packages:
[1] reprex_0.3.0 DMwR_0.4.1 lattice_0.20-38
[4] randomForestSRC_2.9.0 survival_2.44-1.1 dplyr_0.8.1
[7] openxlsx_4.1.0 xlsx_0.6.1 foreign_0.8-71

loaded via a namespace (and not attached):
[1] zip_2.0.2 Rcpp_1.0.1 pillar_1.4.1 compiler_3.6.0
[5] bitops_1.0-6 class_7.3-15 tools_3.6.0 xts_0.11-2
[9] rpart_4.1-15 tibble_2.1.1 pkgconfig_2.0.2 rlang_0.3.4
[13] Matrix_1.2-17 rstudioapi_0.10 curl_3.3 parallel_3.6.0
[17] rJava_0.9-11 fs_1.3.1 caTools_1.17.1.2 gtools_3.8.1
[21] xlsxjars_0.6.1 tidyselect_0.2.5 glue_1.3.1 R6_2.4.0
[25] gdata_2.18.0 ROCR_1.0-7 purrr_0.3.2 TTR_0.23-4
[29] magrittr_1.5 gplots_3.0.1.1 splines_3.6.0 assertthat_0.2.1
[33] abind_1.4-5 quantmod_0.4-14 KernSmooth_2.23-15 crayon_1.3.4
[37] zoo_1.8-5

SysInfo:
sysname release version nodename
"Windows" "10 x64" "build 17134" "DESKTOP-20SFEN1"
machine login user effective_user
"x86-64" "WIKON" "WIKON" "WIKON"

R Version:
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 6.0
year 2019
month 04
day 26
svn rev 76424
language R
version.string R version 3.6.0 (2019-04-26)
nickname Planting of a Tree
$ALLUSERSPROFILE
[1] "C:\ProgramData"

$APPDATA
[1] "C:\Users\WIKON\AppData\Roaming"

$CLICOLOR_FORCE
[1] "1"

$CommonProgramFiles
[1] "C:\Program Files\Common Files"

$CommonProgramFiles(x86)
[1] "C:\Program Files (x86)\Common Files"

$CommonProgramW6432
[1] "C:\Program Files\Common Files"

$COMPUTERNAME
[1] "DESKTOP-20SFEN1"

$ComSpec
[1] "C:\WINDOWS\system32\cmd.exe"

$DISPLAY
[1] ":0"

$DriverData
[1] "C:\Windows\System32\Drivers\DriverData"

$FPS_BROWSER_APP_PROFILE_STRING
[1] "Internet Explorer"

$FPS_BROWSER_USER_PROFILE_STRING
[1] "Default"

$GFORTRAN_STDERR_UNIT
[1] "-1"

$GFORTRAN_STDOUT_UNIT
[1] "-1"

$HOME
[1] "C:/Users/WIKON/Documents"

$HOMEDRIVE
[1] "C:"

$HOMEPATH
[1] "\Users\WIKON"

$LOCALAPPDATA
[1] "C:\Users\WIKON\AppData\Local"

$LOGONSERVER
[1] "\\DESKTOP-20SFEN1"

$MSYS2_ENV_CONV_EXCL
[1] "R_ARCH"

$NUMBER_OF_PROCESSORS
[1] "4"

$OneDrive
[1] "C:\Users\WIKON\OneDrive"

$OneDriveConsumer
[1] "C:\Users\WIKON\OneDrive"

$OS
[1] "Windows_NT"

$PATH
[1] "C:\Program Files\R\R-3.6.0\bin\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH\;C:\Users\WIKON\AppData\Local\Microsoft\WindowsApps;C:\Users\WIKON\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\"

$PATHEXT
[1] ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"

$PROCESSOR_ARCHITECTURE
[1] "AMD64"

$PROCESSOR_IDENTIFIER
[1] "Intel64 Family 6 Model 78 Stepping 3, GenuineIntel"

$PROCESSOR_LEVEL
[1] "6"

$PROCESSOR_REVISION
[1] "4e03"

$ProgramData
[1] "C:\ProgramData"

$ProgramFiles
[1] "C:\Program Files"

$ProgramFiles(x86)
[1] "C:\Program Files (x86)"

$ProgramW6432
[1] "C:\Program Files"

$PSModulePath
[1] "C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules"

$PUBLIC
[1] "C:\Users\Public"

$QT_D3DCREATE_MULTITHREADED
[1] "1"

$R_ARCH
[1] "/x64"

$R_COMPILED_BY
[1] "gcc 4.9.3"

$R_DOC_DIR
[1] "C:/PROGRA~1/R/R-36~1.0/doc"

$R_HOME
[1] "C:/PROGRA~1/R/R-36~1.0"

$R_LIBS_USER
[1] "C:/Users/WIKON/Documents/R/win-library/3.6"

$R_USER
[1] "C:/Users/WIKON/Documents"

$RMARKDOWN_MATHJAX_PATH
[1] "C:/Program Files/RStudio/resources/mathjax-26"

$RS_LOCAL_PEER
[1] "\\.\pipe\41236-rsession"

$RS_RPOSTBACK_PATH
[1] "C:/Program Files/RStudio/bin/rpostback"

$RS_SHARED_SECRET
[1] "63341846741"

$RSTUDIO
[1] "1"

$RSTUDIO_CONSOLE_COLOR
[1] "256"

$RSTUDIO_CONSOLE_WIDTH
[1] "80"

$RSTUDIO_MSYS_SSH
[1] "C:/Program Files/RStudio/bin/msys-ssh-1000-18"

$RSTUDIO_PANDOC
[1] "C:/Program Files/RStudio/bin/pandoc"

$RSTUDIO_SESSION_PORT
[1] "41236"

$RSTUDIO_USER_IDENTITY
[1] "WIKON"

$RSTUDIO_WINUTILS
[1] "C:/Program Files/RStudio/bin/winutils"

$SESSIONNAME
[1] "Console"

$SynaProgDir
[1] "Synaptics\SynTP"

$SystemDrive
[1] "C:"

$SystemRoot
[1] "C:\WINDOWS"

$TEMP
[1] "C:\Users\WIKON\AppData\Local\Temp"

$TERM
[1] "xterm-256color"

$TMP
[1] "C:\Users\WIKON\AppData\Local\Temp"

$USERDOMAIN
[1] "DESKTOP-20SFEN1"

$USERDOMAIN_ROAMINGPROFILE
[1] "DESKTOP-20SFEN1"

$USERNAME
[1] "WIKON"

$USERPROFILE
[1] "C:\Users\WIKON"

$windir
[1] "C:\WINDOWS"

[1] ".GlobalEnv" "package:reprex" "kdhs"
[4] "package:DMwR" "package:grid" "package:lattice"
[7] "package:randomForestSRC" "package:survival" "package:dplyr"
[10] "package:openxlsx" "package:xlsx" "package:foreign"
[13] "tools:rstudio" "package:stats" "package:graphics"
[16] "package:grDevices" "package:utils" "package:datasets"
[19] "package:methods" "Autoloads" "package:base"
Log file: rdesktop.log

10 Jun 2019 07:32:32 [rdesktop] ERROR system error 138 (The system tried to join a drive to a directory on a joined drive); OCCURRED AT: class rstudio::core::Error __cdecl rstudio::core::waitWithTimeout(const class rstudio_boost::function<struct rstudio::core::WaitResult __cdecl(void)> &,int,int,int) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\core\waitutils.cpp:63; LOGGED FROM: class rstudio::core::Error __cdecl rstudio::desktop::SessionLauncher::launchNextSession(bool) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\desktop\desktopsessionlauncher.cpp:339

Log file: rsession-WIKON.log

08 Jun 2019 13:10:26 [rsession-WIKON] ERROR system error 10053 (An established connection was aborted by the software in your host machine) [request-uri=/events/get_events]; OCCURRED AT: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:111; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:116
08 Jun 2019 14:00:27 [rsession-WIKON] ERROR system error 10053 (An established connection was aborted by the software in your host machine) [request-uri=/events/get_events]; OCCURRED AT: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:111; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:116
08 Jun 2019 14:09:42 [rsession-WIKON] ERROR system error 10053 (An established connection was aborted by the software in your host machine) [request-uri=/events/get_events]; OCCURRED AT: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:111; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:116
08 Jun 2019 14:30:02 [rsession-WIKON] ERROR system error 10053 (An established connection was aborted by the software in your host machine) [request-uri=/events/get_events]; OCCURRED AT: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:111; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:116
08 Jun 2019 14:54:37 [rsession-WIKON] ERROR system error 10053 (An established connection was aborted by the software in your host machine) [request-uri=/events/get_events]; OCCURRED AT: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:111; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:116
08 Jun 2019 15:09:25 [rsession-WIKON] ERROR system error 10053 (An established connection was aborted by the software in your host machine) [request-uri=/events/get_events]; OCCURRED AT: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:111; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:116
08 Jun 2019 15:10:23 [rsession-WIKON] ERROR system error 10053 (An established connection was aborted by the software in your host machine) [request-uri=/events/get_events]; OCCURRED AT: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:111; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:116
10 Jun 2019 07:24:30 [rsession-WIKON] ERROR system error 10053 (An established connection was aborted by the software in your host machine) [request-uri=/events/get_events]; OCCURRED AT: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:111; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionImpl::sendResponse(const class rstudio::core::http::Response &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionimpl.hpp:116
10 Jun 2019 07:31:15 [rsession-WIKON] ERROR system error 10055 (An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full); OCCURRED AT: void __cdecl rstudio::session::HttpConnectionListenerImpl::handleAccept(const class rstudio_boost::system::error_code &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionlistenerimpl.hpp:221; LOGGED FROM: void __cdecl rstudio::session::HttpConnectionListenerImpl::handleAccept(const class rstudio_boost::system::error_code &) c:\jenkins\workspace\ide\windows-v1.2\src\cpp\session\http\sessionhttpconnectionlistenerimpl.hpp:221
From RStudio Desktop Will Not Start on support.rstudio.com

1 Like

Hi, welcome!

Very often, this error is related with an out of RAM memory issue, to rule this out, could you tell us, what is the code you are trying to run?
Ideally, could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

Hi,
Thank you @andresrcs for your response. I'm not sure whether the problem is with the code. My data set has 20946 observations with 828 variables. When i use a smaller data set with 200 observations and 28 variables, the code works very well and the error is no more. Could it be because of the big data set?

The dataset is not that big per se, but maybe your code or the packages you are using are not very memory efficient, the thing is that very likely you are running out of RAM memory.

Maybe if you post a reproducible example of your task in hand, some one could give you an alternative approach to avoid this memory issue.

Hi,
I have generated two data sets (survival data from https://cran.r-project.org/web/packages/simsurv/simsurv.pdf and missing data from https://www.gerkovink.com/Amputation_with_Ampute/Vignette/ampute.html) then combined the two. This is because I am doing random survival forest for imputed data.

library(survival)
library(randomForestSRC)
#> 
#>  randomForestSRC 2.9.0 
#>  
#>  Type rfsrc.news() to see new features, changes, and bug fixes. 
#> 
library(reprex)
library(simsurv)
 
##generating survival data
set.seed(123)
covs <- data.frame(id = 1:1000, trt = stats::rbinom(100, 1L, 0.5))
s1 <- simsurv(lambdas = 0.1, gammas = 1.5, betas = c(trt = -0.5),
              x = covs, maxt = 5)
head(s1)
#>   id eventtime status
#> 1  1  1.087991      1
#> 2  2  5.000000      0
#> 3  3  3.784815      1
#> 4  4  5.000000      0
#> 5  5  5.000000      0
#> 6  6  1.158834      1

###generating missing data
require("mice")
#> Loading required package: mice
#> Loading required package: lattice
#> 
#> Attaching package: 'mice'
#> The following objects are masked from 'package:base':
#> 
#>     cbind, rbind
set.seed(2016)
testdata <- MASS::mvrnorm(n = 10000, mu = c(10, 5, 0), Sigma = matrix(data = c(1.0, 0.2, 0.2, 0.2, 1.0, 0.2, 0.2, 0.2, 1.0), nrow = 3, byrow = T))
testdata <- as.data.frame(testdata)
summary(testdata)
#>        V1               V2               V3           
#>  Min.   : 6.346   Min.   :0.9789   Min.   :-3.799124  
#>  1st Qu.: 9.317   1st Qu.:4.3199   1st Qu.:-0.690542  
#>  Median :10.003   Median :4.9963   Median :-0.009941  
#>  Mean   : 9.998   Mean   :4.9973   Mean   : 0.000759  
#>  3rd Qu.:10.677   3rd Qu.:5.6759   3rd Qu.: 0.673069  
#>  Max.   :13.770   Max.   :8.6579   Max.   : 3.810729
result <- ampute(testdata)
head(result$amp)
#>          V1       V2         V3
#> 1        NA 6.018999  0.3681981
#> 2  9.668991 4.391821 -1.1127595
#> 3 10.273415 4.662521  0.1796964
#> 4 10.124800 4.055544         NA
#> 5        NA 7.171578  1.7141378
#> 6 10.803311 5.038649         NA

###Combining the data
data<-data.frame(result$amp,s1)
#> Warning in data.frame(result$amp, s1): row names were found from a short
#> variable and have been discarded
head(data)
#>          V1       V2         V3 id eventtime status
#> 1        NA 6.018999  0.3681981  1  1.087991      1
#> 2  9.668991 4.391821 -1.1127595  2  5.000000      0
#> 3 10.273415 4.662521  0.1796964  3  3.784815      1
#> 4 10.124800 4.055544         NA  4  5.000000      0
#> 5        NA 7.171578  1.7141378  5  5.000000      0
#> 6 10.803311 5.038649         NA  6  1.158834      1

Created on 2019-06-11 by the reprex package (v0.3.0)

#######
####RANDOM SURVIVAL FOREST
fitMice<-rfsrc(Surv(eventtime,status)~., data, ntree=1000, mtry=NULL, importance="permute", 
               forest=T, splitrule = "logrank", nsplit = 10,na.action = "na.impute",method="vimp", tree.err = T)
#> Error in rfsrc(Surv(eventtime, status) ~ ., data, ntree = 1000, mtry = NULL, : could not find function "rfsrc"

Created on 2019-06-11 by the reprex package (v0.3.0)
This is not the error that i get when i run the code. But i still get this "R encountered a fatal error. The session was terminated."

I have run your code and I´m able to fit the model using a small AWS EC2 instance with 1 Core 1GB RAM + 3GB SWAP memory.

What are the characteristics of your system? on which operating system are you? I think that a simple solution for you would be to add some SWAP memory to your system but the way to do it depends on your OS.

Hi,
Thank you @andresrcs for your response. I am using Microsoft Windows 10 version 1803 (OS Build 17134.765).

How can I add the SWAP memory?

I have never done this in windows, but I have found this article that could be useful for you, notice that, in windows, SWAP memory is called Virtual Memory.

https://www.geeksinphoenix.com/blog/post/2016/05/10/how-to-manage-windows-10-virtual-memory.aspx

I have tried this but I'm still getting the same error.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.