eolk
October 16, 2024, 9:47am
1
We have had problems in our newly setup Posit Workbench environment (2024.04.0+735.pro3) with random crashes of long running jobs. As a test I created a simple function in a project in Posit Cloud and could replicate the error, which leads me to think that the problem is not in our local setup but a more general problem.
Executing the dummy code below (I know it's inefficient, but that should not cause it to crash randomly) and then switching a few times back and forth between the Workspace overview and the executing project so that the project page is reloaded eventually results in a crashed session. I have not been able to replicate the crash without leaving the session.
The error message that comes up is "The previous R session was abnormally terminated due to an unexpected crash..." but many times the session has just been restarted and the history lost without any error message.
The problem did not appear in our old Workbench environment (2022.12.0+353.pro20).
rm(list = ls())
control = data.frame(lopnr=1:1e6,is_female=sample(c(0,1),1e6,replace=T))
print(nrow(control))
sink(file='loop.out')
for (i in 1:nrow(control)){
dat<-control[i, ]
print(dat)
flush.console()
}
sink(file=NULL)
Hi @eolk
Thanks for reaching out. I can see you have opened a support ticket. I have sent a response there asking for some more diagnostic information for review. When we find the cause and solution, we will update both the ticket and this post.
Regards,
Lachlan
jlsm
October 17, 2024, 9:45am
3
Hi
We've been helping @eolk with this issue and have created a bug report for it here:
opened 09:34AM - 17 Oct 24 UTC
bug
new
### System details
RStudio Edition : Server
RStudio Version : v2024.… 09.0+375
OS Version : Ubuntu 22.04.5 LTS
R Version : 4.4.1
### Steps to reproduce the problem
Install R and RStudio Server according to instructions [https://posit.co/download/rstudio-server/](here). No need to change any configuration files.
Install systemd-coredump and ensure it is enabled:
```
$ systemctl is-active systemd-coredump.socket ; cat /proc/sys/kernel/core_pattern
active
|/lib/systemd/systemd-coredump %P %u %g %s %t 9223372036854775808 %h
```
Open up a browser tab (preferably no other tabs open at all), log in and create a new Rscript file called loop.R with the following content
```
rm(list = ls())
control = data.frame(lopnr=1:1e6,is_female=sample(c(0,1),1e6,replace=T))
print(nrow(control))
sink(file='loop.out')
for (i in 1:nrow(control)){
dat<-control[i, ]
print(dat)
flush.console()
}
sink(file=NULL)
```
Save the file
Select all the text in the file
Click Run
Copy the URL from the browser's URL field
Close the browser tab
Wait some amount of seconds
Paste the copied URL in to the browser's URL field
Press enter
The `rsession` process has now either crashed and there's an error message like this one:
![rsession-crash](https://github.com/user-attachments/assets/56074c07-aadc-4f2e-adfc-3413cce8bec9)
or it has simply crashed silently, which you'll know because systemd-coredump captured a coredump, for example yoyu can check it like this:
```
# coredumpctl list
TIME PID UID GID SIG COREFILE EXE SIZE
Thu 2024-10-17 09:09:55 UTC 3444 1000 1000 SIGSEGV present /usr/lib/rstudio-server/bin/rsession 26.5M
```
The crash message does not always appear for some reason. Either way you should be able to see that the `loop.out` file did not get filled out all the way.
### Describe the problem in detail
To get a somewhat useful coredump, I set up a fresh Ubuntu 22.04 virtual machine and compiled the `v2024.09.0+375` tag from git with the `Server` target and `Debug` build type and installed it according to the [INSTALL](https://github.com/rstudio/rstudio/blob/main/INSTALL) instructions.
Here's my output from running `gdb /usr/local/bin/rsession /path/to/coredump`:
[gdb-ression-v2024.09.0+375-git-coredump-2024-10-16.log.txt](https://github.com/user-attachments/files/17409075/gdb-ression-v2024.09.0%2B375-git-coredump-2024-10-16.log.txt)
Line 33 sticks out to me:
```
#0 0x000055cd72d8bc15 in rstudio::session::modules::environment::(anonymous namespace)::callFramesAsJson (depth=0, pContext=0x7fff80ae35f0, pSrcContext=0x7fff80ae3610, pLineDebugState=0x0) at /home/vagrant/rstudio/src/cpp/session/modules/environment/SessionEnvironment.cpp:810
```
I can send the whole coredump + built files if needed.
I also tried compiling the **main branch** (commit `7cf20b1db94cb5a9493363e03841d7ca35207f90`) and was able to **reproduce** the crash there, but did not get the error message that time.
### Describe the behavior you expected
I expect it to not crash in this scenario.
- [x] I have read the guide for [submitting good bug reports](https://github.com/rstudio/rstudio/wiki/Writing-Good-Bug-Reports).
- [x] I have installed the latest version of RStudio, and confirmed that the issue still persists.
- [X] If I am reporting an RStudio crash, I have included a [diagnostics report](https://support.posit.co/hc/en-us/articles/200321257-Running-a-Diagnostics-Report).
- [x] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
I don't have a diagnostics report here because running `rstudio-server run-diagnostics` does not produce anything on my test VM, but this **is reproducible in Posit Workbench** as well, except triggering it is slightly different there because usually you're switching from a different, concurrently running session (which is not possible in RStudio Server AFAIK). We have an ongoing ticket for it (#111182) so I guess I'll refer to the diagnostics reports in there. Here it's a plain Ubuntu 22.04 install and without any changes to configuration files like `/etc/rstudio/rserver.conf`, etc.
There's a forum post about this issue here as well: https://forum.posit.co/t/unexpected-crash-when-leaving-and-restoring-executing-session/194050
Happy to provide any additional info I may have missed.
1 Like