[R] inconsistency in mclapply.....
kry|ov@r00t @end|ng |rom gm@||@com
Sat Jun 10 09:24:50 CEST 2023
On Fri, 9 Jun 2023 21:19:11 +0000
akshay kulkarni <akshay_e4 using hotmail.com> wrote:
> debug at <tmp>#26: LYG <- mclapply(LYGH, FUN = arfima, mc.cores = 2,
> mc.preschedule = FALSE)
> Browse> LYG <- pbmclapply(LYGH,FUN = arfima,mc.cores =
> 2,mc.preschedule = FALSE)
> | | 0%, ETA NA
So if you interrupt the code _after_ it hangs at 0%, ETA NA, what's the
traceback? (We're doing this to confirm that the parent process hangs
in either selectChildren() or readChild().)
> You might be interested in this:
> [ec2-user using ip-172-31-15-116 ~]$ exit
> There are stopped jobs.
> THis occurs when I close R and try to exit the shell prompt( I am on
> an AWS EC2 RHEL 8 Instance). Can this lead you somewhere?
I guess this proves the existence of child processes, probably spawned
by mclapply, but why would they be _stopped_, I don't know. What's the
output of jobs -l at this point?
(This suggests trying to send them a SIGCONT and seeing what happens.
Does mclapply() get unstuck if you run the command killall -SIGCONT R
from a separate ssh connection? Would be strange if it worked, but
worth a try.)
> As of now I have quit R in my machine, so I can't get session
Knowing the output of sessionInfo() could still be useful for solving
the problem. It's best to show the output after loading all the
packages, ideally just before you reproduce the problem.
> by the by, how do you run top when running R? I think at least in my
> machine, you have to quit R to get to the shell prompt...
I can think of 3 options:
1) Type Ctrl+Z at the R prompt. R (and the rest of the process group, I
think) becomes suspended, you return to the command line prompt where
you can run other commands. At the system command line prompt, type
"fg" and press Enter in order to continue running R. (Press Enter a
second time so that R prints its command line prompt again.) This is
quick, doesn't require preparation, but messes up the state of the
processes you're interested in. (They become suspended instead of
running, which may complicate debugging.)
2) Open a second ssh connection to the same machine the same way you
had opened the first one. You won't be able to (easily) interact with
the R session running in the first connection, but you'll get a second
system command line where you'll be able to run top, gdb, and other
commands, which should let you inspect the state of the system.
3) Before starting R, install a "terminal multiplexer", that is, GNU
Screen or tmux. If you're still on RHEL, use sudo dnf install screen or
sudo dnf install tmux. One of these commands needs to be run once per
computer. Type the name of the program ("screen" or "tmux") to start it.
Inside screen/tmux, start R.
In Screen, use Ctrl+A then C in order to create a new virtual terminal;
Ctrl+A then type the number in order to switch between terminals. In
tmux, use Ctrl+B then C in order to create a new virtual terminal;
Ctrl+B then type the number in order to switch between them. Terminals
are numbered from 0 upwards, so the second one will be numbered 1, and
More information about the R-help