Closed avraam-inside closed 2 years ago
Can you try to create a reproducible example? E.g. you mention run()
but p$read_all_error_lines()
is about the R6 class and not run()
. Hopefully a reproducible example will clarify this.
Yes, I just tried both through run and through R6.
Crashes on any code.
It takes and hangs sometimes. It is expected to work in 4 seconds usually, sometimes it hangs after a couple of minutes.
An example of how I did:
processx::run('bash', c('-c', 'cd /home && R --no-save --no-restore-data --quiet -e "print(\'123\')"'))
and
p <- processx::process$new('bash', c('-c', 'cd /home && R --no-save --no-restore-data --quiet -e "print(\'123\')"')), stdout = "|", stderr = "|", wd = here())
p$poll_io(50000000)
stderr <- p$read_all_error_lines()
stdout <- p$read_all_output_lines()
close(p$get_output_connection())
close(p$get_error_connection())
p$kill_tree()
p$kill()
An example of how I did:
This runs in ~ 150ms for me, so that is definitely weird, even if it runs. It also never crashes or hangs for me. What is your platform?
system.time({
p <- processx::process$new('bash', c('-c', 'cd /home && R --no-save --no-restore-data --quiet -e "print(\'123\')")'), stdout = "|", stderr = "|", wd = here::here())
p$wait()
})
This also does not crash, but finishes in ~5ms.
It falls only occasionally. But even this is sometimes enough to cause problems.
Ubuntu in container
It falls only occasionally.
I just ran it ~8000 times...
Ubuntu in container
That's great, so then can you create a Dockerfile
that reproduces this?
It won't work, there's too much code, the service is on a shiny-proxy, with its own package and oun autotests and renv, the error repeats relatively rarely and there is no clear pattern how to cause it.
But after waiting for n time, I probably found the area with which it is connected - most likely with renv...
It's very strange why it climbs into CRAN. When restarting - everything works normally, the error is not repeated.
If you suddenly have ideas or have encountered them before, I will be glad to help. But it seems that the problem is not in the processx.
when running standard scripts (for example:)
run('bash', c('-c', 'ls'))
the session sometimes hangings.I've already tried everything:
cleanup_tree
, and using R6 methods withrm(p)
andgc()
andkill()
reading outputs:and etc/etc
NOTHING IS WORKING.
Please tell me a sane way to clear buffers, caches, etc. before/after the script so that run does not hang. This has never happened with the
system()
command at all.