How do I ask for help solving an Rstudio crash

I am performing simulations as part of an analysis.
The code used for the simulation is quite complex so I made a package for it.
All of the functions seemed to work happily until I made the computer run a simulation that lasts for about 9 hours.
For some reason, Rstudio crashes after about 3 hours or roughly 30 simulations. When I restart the simulation process (It is designed to continue from the last saved simulation) it carries on as if nothing had happened then crashes again 30-40 simulations later. Usually, the third round is enough to get it to complete.
This problem means it takes forever to perform the 100 simulations I need for each setting, and it means I can't just leave the computer running and let it go through a number of simulation settings

Normally if there is a problem I would look at the error messages and possibly post a reprex to SO. However as this crash is related to Rstudio itself I am not sure what to do.

I know there is a crash analysis button but it contains lots of information and no obvious way to dump it into a file.

How can I get enough information to ask a question that is actually answerable?

I am using

Ubuntu 18.04 LTS (Bionic Beaver),
Rstudio Version 1.1.383
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"

Here’s how to generate an RStudio diagnostics report:

And how to find crash report and application logs:

Along with your basic system info, and your sessionInfo(), that’s pretty much a full complement of stuff to report when looking for help with a crash — other than a reproducible example that causes the crash, which may understandably be hard in this case!

5 Likes

Not a general answer (jcblum's done a great job of that), but does this happen only when you run it in RStudio, but not if you run it in vanilla R?

For disambiguation see:

3 Likes

Thanks that is a really good point. I have another question though if it does turn out that Rstudio is not the culprit (likely), should I still follow jcblum's instructions or do something else?

Thanks for the advice I'll run backtrace and make it crash again. Should I post the results to the Rstudio forum with the question like i had a regular question?

Regards

Jonno

If you're not running it in RStudio, you won't have a crash log in the RStudio application files, but you may 1. still be able to get a useful crash log from within RStudio, and 2. should be able to get one from outside of RStudio (if in the R app there are instructions here: https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#R_002eapp-Bugs, but you should reproduce from the console anyhow, since if it's happening in both, it'll likely happen from the console as well, and, thus, won't be a GUI issue). I'm not sure what the best way to do the last piece is though, sorry!

2 Likes

You can also generate some debug information from your simulation. The diagnostics in RStudio are more likely to be the low level details, and if there is something wrong happened in simulation, printing information from there will make you look at the right places much faster.

You can at least print some information for each round, try to reduce the time it crashes (so you can test more in less time), try to duplicate the crash more specifically etc.

It could also be some memory issues, like some memory or limited resources are used up.

2 Likes

Yes, a new topic would probably be best, once you manage to define the problem further. You can link a new topic to this one by clicking the Share button at the bottom of this topic, then clicking on + New Topic in the little popover window.

If it turns out it’s not IDE-dependent, it’s a good idea to pick a category other than #rstudio-ide. Good luck! I’m personally placing my bet on a memory problem, but I live to be surprised :wink:

1 Like

My hunch is with you and @dracodoc that it is a memory issue. I tried sticking gc(), all over the place but it didn't help. However, some sort of memory leak would be the most obvious reason why the crash; doesn't occur until well into the simulation; doesn't throw an error; doesn't reproduce when the simulation that the crash occurred on is re-run. Hopefully the crash log will give some who is better than me (aka you guys) a clue as how to fix it.

I have now crashed Rstudio and got the data. However, txt files can't be uploaded to this community. Should I save them as PDF's? how do people normally do it?

...Sorry for such unbearably noob questions

As long as you're not bumping into anything like a post size limit, you could simply paste the results into your post. BUT I'd be sure to do two things:

  1. Insert a "Hide Details" segment (gear menu at the top of the posting box > "Hide Details"), then paste your log where it says "this text will be hidden", and change the default "Summary" title to something meaningful.
  2. Select all the log output you just pasted and click the </> button at the top of the posting box, to format it as code (usually easier to read since logs tend to assume a fixed width font, and this way special chars won't accidentally trigger Markdown formatting).

If it's just too much text for that, how about one of the suggestions here:

2 Likes

If it's a memory problem you can try writing this line
utils::memory.limit(20000)
on user/documents/.Rprofile
Yo can try even with a number larger than your physical RAM size, it will be slow but will work.