mlr-org / mlr-org/batchtools

explicitly undo side effects of makeCluster

Open
#220 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
184
Forks
53
Avg merge
7d 2h
Merged PRs (30d)
1

Description

Some makeCluster* operations have side effects, e.g., opening connections

> nrow(showConnections())
[1] 0
> cl = makeClusterFunctionsSocket(2)
> nrow(showConnections())
[1] 2

There is no way to 'undo' (e.g., destroyCluster(cl)) these side-effects, and they are not destroyed by, e.g., removeRegistry(). I realize that there is a finalizer, so

> rm(cl)
> gc()
          used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
Ncells  542172 29.0     934164 49.9         NA   934164 49.9
Vcells 1473945 11.3    8388608 64.0      32768  8386115 64.0
> nrow(showConnections())
[1] 0

often works, but actually finalizers are not run in a deterministic order so that the this is not robust.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the side effects of makeClusterFunctionsSocket and the existing finalizer behavior, then compare them with removeRegistry and the proposed destroyCluster(cl) operation. Verify cleanup using showConnections() before and after explicit destruction; done means resources are released deterministically without relying on rm() or gc().

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.