Use pidfd to track processes on Linux >= 5.4
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 32/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- haskell, linux
- Ambito
- operating-systems
Direzione di ricerca
Inizia da ProcessHandle della libreria dei processi e dai percorsi di creazione dei processi, quindi leggi i riferimenti collegati a pidfd_open(), clone() e waitid(), insieme all’implementazione Rust collegata. L’issue descrive il tracciamento di un pidfd su Linux 5.4+ e il suo utilizzo per attendere i processi in modo più sicuro; done dovrebbe preservare il comportamento esistente evitando al contempo le race condition dovute al riutilizzo dei PID.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Background:
The problem Pids in ProcessHandles is that on most system they are limited to 2^16 many by default. If you spawn many short-lived processes quickly, the pid namespace can wrap around and you will accidentally waitForProcess (wait()) on the wrong process, or terminateProcess the wrong one.
Linux 5.4 solves this with pidfds (which are per-process, and 32-bit many). They can point to zombie processes so they will never accidentally point to a different process.
The process library could use them on newer Linux by simply tracking the pidfd in a Maybe field inside ProcessHandle.
- After being spawned, a pid can be converted to a
pidfdusingpidfd_open()-- but this is still slightly racy, and better is to get it atomically directly fromclone(). But it's an easy migration path that's a strict improvement already. - pidfds can be waited on with
select(),epoll()and so on, which means we can use the GHC IO manager to wait for them more efficiently than with the usualwaitForProcess.
This Rust library https://github.com/pop-os/pidfd shows how you can wait for a program to finish using waitid().
- Lingua principale
- Haskell
- Stelle
- 91
- Fork
- 93
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di haskell/process
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
HAVE_PIPE2 at compile time but not at runtime causes segfault on macOSForse già presa @alt-romes l’ha presa 3 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
posix_spawn falls back to fork() when create_group = True due to HAVE_DECL_ macro mismatchForse già presa @lei-jia-xing l’ha presa 11 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Tutte le issue di haskell/process
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
haskell/bytestring#730 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
seal-harness/seal-harness#399 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
fmidue/codeworld-tasks#124 ·
-
allow haskell-src-exts-1.24Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
reflex-frp/reflex#563 ·