Thanks Bill for checking that.
It was my impression that warnings are raised from some internal
system calls made when quitting R. At that point I don't have much
control over checking the return status of those.
Your suggestion looks good to me.

Tomas, do you think this could help? could this be implemented?

On Mon, Nov 23, 2020 at 7:10 PM Bill Dunlap <williamwdun...@gmail.com> wrote:
>
> The call to system() probably is an internal call used to delete the 
> session's tempdir().  This sort of failure means that a potentially large 
> amount of disk space is not being recovered when R is done.  Perhaps 
> R_CleanTempDir() could call R_unlink() instead of having a subprocess call 
> 'rm -rf ...'.  Then it could also issue a specific warning if it was 
> impossible to delete all of tempdir().  (That should be very rare.)
>
> > q("no")
> Breakpoint 1, R_system (command=command@entry=0x7fffffffa1e0 "rm -Rf 
> /tmp/RtmppoKPXb") at sysutils.c:311
> 311     {
> (gdb) where
> #0  R_system (command=command@entry=0x7fffffffa1e0 "rm -Rf /tmp/RtmppoKPXb") 
> at sysutils.c:311
> #1  0x00005555557c30ec in R_CleanTempDir () at sys-std.c:1178
> #2  0x00005555557c31d7 in Rstd_CleanUp (saveact=<optimized out>, status=0, 
> runLast=<optimized out>) at sys-std.c:1243
> #3  0x00005555557c593d in R_CleanUp (saveact=saveact@entry=SA_NOSAVE, 
> status=status@entry=0, runLast=<optimized out>) at system.c:87
> #4  0x00005555556cc85e in do_quit (call=<optimized out>, op=<optimized out>, 
> args=0x555557813f90, rho=<optimized out>) at main.c:1393
>
> -Bill
>
> On Mon, Nov 23, 2020 at 3:15 AM Tomas Kalibera <tomas.kalib...@gmail.com> 
> wrote:
>>
>> On 11/21/20 6:51 PM, Jan Gorecki wrote:
>> > Dear R-developers,
>> >
>> > Some of the more fat scripts (50+ GB mem used by R) that I am running,
>> > when they finish they do quit with q("no", status=0)
>> > Quite often it happens that there is an extra stderr output produced
>> > at the very end which looks like this:
>> >
>> > Warning message:
>> > In .Internal(quit(save, status, runLast)) :
>> >    system call failed: Cannot allocate memory
>> >
>> > Is there any way to avoid this kind of warnings? I am using stderr
>> > output for detecting failures in scripts and this warning is a false
>> > positive of a failure.
>> >
>> > Maybe quit function could wait little bit longer trying to allocate
>> > before it raises this warning?
>>
>> If you see this warning, some call to system() or system2() or similar,
>> which executes an external program, failed to even run a shell to run
>> that external program, because there was not enough memory. You should
>> be able to find out where it happens by checking the exit status of
>> system().
>>
>> Tomas
>>
>>
>> >
>> > Best regards,
>> > Jan Gorecki
>> >
>> > ______________________________________________
>> > R-devel@r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> ______________________________________________
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to