Closed tmspvn closed 2 days ago
This is weird. I don't think I've heard of such a problem ever before.
Some quick troubleshooting suggestions:
cl <- parallel::makeCluster(2); print(cl);
work?cl <- parallelly::makeClusterPSOCK(2); print(cl)
work?The latter is what's used under the hood by multisession
and cluster
.
Also, make sure to try outside of RStudio, i.e. by running R
from the terminal. That could help narrow in on the problem.
FWIW, I'm also on Ubuntu 22.04 running R 4.4.1 with the same locale, and this works just fine for me.
Hi,
thanks for the fast answer.
I tried both calls and they hang as well. I called them both from outside rstudio. The second call returned this after a while:
Error in parallelly::makeClusterPSOCK(2) :
Cluster setup failed (connectTimeout=125.0 seconds). 2 of 2 workers failed to connect.
Edit: reinstalling parallelly doens't help
I suggest you focus on
cl <- parallel::makeCluster(2) print(cl)
in a vanilla R session. This is a problem unrelated to any R packages you've installed and there's nothing that the futureverse can fix.
I recommend retrying to install R, try another R version, etc. Then reach out to the R-help mailing list for help.
Hi,
indeed it's unrelated. I wasn't able to fix it but I figure out that by disabling the wired network connection (the ethernet network) it is able to connect to the workers and everything works fine. When is active it it fails.
Literally, plan(cluster)
returns the instant i disable the connection.
Do you have any clue how to solve it or where to look? I will post on the R-help as soon my email gets approved
What does:
> cl <- parallelly::makeClusterPSOCK(1, dryrun = TRUE)
output with and without the Ethernet cable connected?
R --vanilla, connection OFF:
'/usr/lib/R/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'options(socketOptions = "no-delay")' -e 'workRSOCK <- tryCatch(parallel:::.workRSOCK, error=function(e) parallel:::.slaveRSOCK); workRSOCK()' MASTER=localhost PORT=11922 OUT=/dev/null TIMEOUT=2592000 XDR=FALSE SETUPTIMEOUT=120 SETUPSTRATEGY=sequential
R --vanilla, connection ON:
'/usr/lib/R/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'options(socketOptions = "no-delay")' -e 'workRSOCK <- tryCatch(parallel:::.workRSOCK, error=function(e) parallel:::.slaveRSOCK); workRSOCK()' MASTER=localhost PORT=11424 OUT=/dev/null TIMEOUT=2592000 XDR=FALSE SETUPTIMEOUT=120 SETUPSTRATEGY=sequential
It changes only the port but it changes every time i run the code
Good. Then I know the two makes no difference. Next, try:
cl <- parallelly::makeClusterPSOCK(1, master = "127.0.0.1")
print(cl)
With some luck, that one won't stall.
It returns! Thanks a lot!
Is there a way to prevent this? should I pass master = "127.0.0.1"
to plan?
Great. That suggests that Linux interpret hostname localhost
differently. What does:
$ grep -vE "^#" /etc/resolv.conf
$ nslookup localhost
output with and without the Ethernet cable?
... should I pass
master = "127.0.0.1"
to plan?
I don't think that'll work, but I think the following will do the trick:
options(parallelly.localhost.hostname = "127.0.0.1")
However, that will only solve it for this case; you'll run into other problems like not being able to launch things like Shiny because your Ubuntu setup is somehow messed up.
With the Ethernet ON (i need to censor the address because i am on a sensitive network, which could be the cause of it):
$ grep -vE "^#" /etc/resolv.conf
nameserver 127.0.0.53
options edns0 trust-ad
search intranet.xxxx
$ nslookup localhost
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: localhost.intranet.xxxx
Address: xx.xxx.xxx.xxx
With the Ethernet OFF
$ grep -vE "^#" /etc/resolv.conf
nameserver 127.0.0.53
options edns0 trust-ad
search .
$ nslookup localhost
Server: 127.0.0.53
Address: 127.0.0.53#53
Name: localhost
Address: 127.0.0.1
Name: localhost
Address: ::1
What does:
$ cat /etc/hosts
show in the two cases?
in both cases it returns nothing
in both cases it returns nothing
Ah. At a minimum, I'd expect it to have the following near the top:
127.0.0.1 localhost
That will tell the computer that hostname localhost
should map to IP number 127.0.0.1
. That is a well defined standard. Without it, it'll resort to the search
rule in /etc/resolv.conf
, which is what appends intranet.xxxx
, which is not found (at all).
Do you have admin rights? If so, call:
$ sudo printf "127.0.0.1\tlocalhost\n" >> /etc/hosts
If you have a local sysadm, you should bring this up with them, because it looks like a misconfiguration.
If you have a local sysadm, you should bring this up with them, because it looks like a misconfiguration.
This is the case for me. I will report it to them, thanks a lot for the help!
When calling plan() with multisession or cluster hangs without returning errors. Sequential works. This start happening after i update the packages, so I did a fresh install of R, Rstudio and all the packages but it didn't solve the problem. I'm using ubuntu jammy
A reproducible example using R code.
Session information