link/unlink is exception unsafe
@hyperthunk y travaille déjà.
Depuis le 9/11/2018.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
Suppose I have the following code
f pid = do
link pid
blocking_operations_which_depend_on_health_of pid
unlink pid
If f is interrupted with an exception, unlink might never be called. Thus I rewrite to:
f pid = bracket_ (link pid) (unlink pid) $
blocking_operations_which_depend_on_health_of pid
But this still doesn't help, because unlink is interruptible, thus if unlink is interrupted with an exception, the process will remain linked to pid after leaving f.
How about
f pid = bracket_ (link pid) (uninterruptibleMask_ $ unlink pid) $
blocking_operations_which_depend_on_health_of pid
?
This introduces the potential for blocking indefinitely. If pid dies while unlink is executing, the link exception cannot be thrown because uninterruptibleMask_ is in effect. However, when unlink completes, the exception cannot be thrown either, because the very unlink definition does not allow it. The only way to avoid illegal behavior would be to have unlink never return or somehow don't throw the link exception (the latter looks impossible to me).
The second attempt is the one I would expect to work. The problem is determining what tweak of unlink semantics would make it to work.
I would like unlink to be uninterruptible, but I don't see how that could be implemented. An alternative is to guarantee that when unlink runs with exceptions masked, it always unlinks before returning, but it might return with an exception if it is interrupted during its execution.
- Langage dominant
- Haskell
- Étoiles
- 754
- Forks
- 101
- Merge moyen
- 1 j 3 h
- PR mergées (30 j)
- 4
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de haskell-distributed/distributed-process
-
enhancement Feature Request
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
haskell-distributed/distributed-process#486 · 1 commentaire · 1 réaction ·
-
discuss enhancement Feature Request
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
haskell-distributed/distributed-process#478 · 4 commentaires · 3 réactions ·
-
enhancement Feature Request
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
haskell-distributed/distributed-process#476 · 2 réactions ·
-
Demonstrating the use of Cloud Haskell for a Raft implementationPeut-être à nouveau libre @LaurentRDC l’a pris il y a 486 jours, et aucune pull request n’est ouverte. Ouverteenhancement Feature Request
haskell-distributed/distributed-process#475 · 3 réactions · 1 personne assignée ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 20/100
haskell-distributed/distributed-process#473 · 4 commentaires · 1 réaction ·
Toutes les issues de haskell-distributed/distributed-process
Issues similaires
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 86/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
compiler-explorer/compiler-explorer#9402 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 95/100
objectionary/phino#2137 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
fmidue/logic-tasks#387 ·