Github user HyukjinKwon commented on a diff in the pull request: https://github.com/apache/spark/pull/18320#discussion_r122861395 --- Diff: R/pkg/inst/worker/daemon.R --- @@ -30,8 +30,42 @@ port <- as.integer(Sys.getenv("SPARKR_WORKER_PORT")) inputCon <- socketConnection( port = port, open = "rb", blocking = TRUE, timeout = connectionTimeout) +selectTimeout <- function() { + if (is.null(parallel:::selectChildren(timeout = 0))) { --- End diff -- Multiple children tests can be done as below: copy and paste this instead ```r p <- parallel:::mcfork() if (inherits(p, "masterProcess")) { Sys.sleep(3L) parallel:::mcexit(0L) } else { p <- parallel:::mcfork() if (inherits(p, "masterProcess")) { Sys.sleep(3L) parallel:::mcexit(0L) } } print("TRUE - the timeout was reached") print("parallel:::selectChildren(timeout = 0):") print(parallel:::selectChildren(timeout = 0)) Sys.sleep(4L) print("PID - child is exited (but not terminated)") print("parallel:::selectChildren(timeout = 0):") print(parallel:::selectChildren(timeout = 0)) invisible(lapply(parallel:::selectChildren(timeout = 0), function(x) { tools::pskill(x, tools::SIGUSR1) })) Sys.sleep(1L) print("NULL - if there are no children") print("parallel:::selectChildren(timeout = 0):") print(parallel:::selectChildren(timeout = 0)) ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org