2

In some R processes, I occasionally see the following on process exit:

*** caught segfault ***
address 0x80, cause 'memory not mapped' 

Traceback:
1: x$unload() 
2: (function(x) x$unload())(<environment>)

An irrecoverable exception occurred. R is aborting now...

There are a few problems keeping me from pinning this down:

  • The issue happens sporadically
  • It occasionally goes away on a retry
  • I don't know which package it's trying to unload

However, since this usually happens on process exit, I'd be fine with just ignoring it, but need an automated way to do so. I also don't really care whether the package is unloaded.

In summary, I'm looking for one of the following:

  • A way to prevent R from unloading packages
  • A way to determine whether the segmentation fault is happening at the end of a process, after the rest of the process has completed, so I can ignore any resulting segfault
  • A way of figuring out which package is causing this problem would help, but it's not certain I can just stop using the package even if I know which one it is

Ideally, whatever solution I use would not require changing the R code of an existing process since I may need to apply this to several processes (otherwise, I could, for example, just write a file when the process succeeds).

I've tried to strace the process to see which call is causing the segfault to get to the bottom of it, which has not returned useful results, but I'd rather just ignore it if possible.

  • I don't see any way you can possibly ignore it - this is happening at the operating system and is unignorable - but your other questions (how to diagnose, prevent, etc.) are good. – Ben Bolker Jan 03 '23 at 04:12
  • @BenBolker I can't prevent the segfault from happening, but I can catch the exit code from the R process and then continue with the process that spawned it if the process finished meaningful work - the question is if I can find some hook that allows me to mark when meaningful work is done. – Shishir Jessu Jan 03 '23 at 16:16

0 Answers0