ROBUSTNESS: Protect against user interrupts for calls that need to be atomic

オープン
#438 コメント 4 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
20/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
r

調査の方向性

まず、パッケージの .onLoad() パスと、issue で言及されている cluster-future のメインワーカー間通信を確認します。アトミックなままにする必要がある呼び出しを特定し、そのうえで suspendInterrupts(expr)、future.onInterrupts オプション、R_FUTURE_ONINTERRUPTS をどのように適用すべきかを、インタラクティブセッションと動作を検証する方法も含めて判断します。

索引モデルが issue の本文から書いたものです。

説明

cluster (PSOCK) enhancement

Background

In interactive R sessions, the user can signal user interrupts by hitting Ctrl-C in the terminal. If this happens while R evaluates a set of R expressions that must all complete or not, there is a risk of breaking the state of a future. In some cases, we can recover from it whereas in others the only solution is to restart R.

Suggestion

In R (>= 3.5.0), we have suspendInterrupts(expr) which suspends user-interrupts with evaluating expression expr.

The first task is to identify places where they can safely protect against user interrupts without risking ending up in a situation where R completely blocks. We can always signal a SIGQUIT (Ctrl-\ in the terminal).

One obvious candidate is for cluster futures in main-worker communication. There should be no need to protect against user-interrupts on the worker's end.

Due to the risk of breaking something, we should probably introduce an R option future.onInterrupts and a corresponding environment variable R_FUTURE_ONINTERRUPTS to allow users/sysadmins to enable or disable this feature. To minimize the introduced overhead from checking these all the time, it's probably better to just do it when the package is loaded, i.e. during .onLoad().

We could start off by enabling these user-interrupt protections only for interactive R sessions.

See also

主要言語
R
スター
1k
フォーク
93
平均マージ
2日 4時間
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

futureverse/future のほかの issue

futureverse/future の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。