Closed alexpiper closed 1 year ago
Thanks for the investigation of the issue and report.
Yes, this is a potential problem with daemons()
as there is an initial synchronisation with dispatcher when it is launched.
If R is configured to perform startup tasks that take longer than 5s, then the daemons()
call will time out before the new dispatcher process has had the chance to run the code to sync back with host. This could be due to any startup configuration and not specific to renv
.
In mirai 0.9.1.9009, daemons()
now takes a numeric value for 'dispatcher' as well as TRUE/FALSE to allow setting the sync timeout in milliseconds. If you set it to say 10000L, can you confirm that it now works in your case?
Thanks for looking into this, increasing the sync timeout to 10000L fixes the issue!
As per https://github.com/ropensci/targets/discussions/1112#discussioncomment-6795593 I have re-implemented a solution through the 'dispatcher' argument allowing an NA value for a longer 20s timeout. This avoids the argument having multiple types, and potential trial and error on the user side with different values. 20s should be more than enough, otherwise there is likely something seriously wrong with the R configuration anyway.
@alexpiper thanks again for reporting this bug. Apologies for changing the solution yet again, but this should be the simplest of all - requiring absolutely no change on your side. The issue is now fixed internally with dispatcher no longer loading any R startup configurations (as it doesn't need them).
If you have time to install the latest development version shikokuchuo/mirai@3529241, it should hopefully now "just work", even in your crew/targets workflows without requiring any updates to those packages.
install.packages("mirai", repos = "shikokuchuo.r-universe.dev")
No problem, thanks for the quick fixes!
Confirming that mirai and the targets/crew workflow is working with the latest development version.
Hi,
I am having an issue with
mirai::daemons
function, where the dispatcher times out when loading larger renv lockfiles (i.e., fails when lockfile contains 260 packages), but runs successfully with a smaller renv lockfile (110 packages). The function works when renv is deactivated, and also works whendispatcher = FALSE
. I first thought this was an issue with targets/crew (See https://github.com/ropensci/targets/discussions/1112#discussioncomment-6776212), but it seems to be related to themirai::daemons
functionThis may be fixable by increasing the
.timelimit
variable?Any help with this would be greatly appreciated