withCreateProcess async exception safety
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Stack de tecnologia
- haskell
- Domínio
- operating-systems
Direção de pesquisa
Comece lendo withCreateProcess, cleanupProcess e waitForProcess juntamente com a discussão de Control.Exception sobre operações interrompíveis. Investigue se takeMVar, hClose ou outras etapas de limpeza podem ser interrompidas, usando a modificação relatada em threadDelay apenas para diagnóstico. O trabalho estará concluído quando o comportamento das exceções assíncronas tiver sido estabelecido com um teste confiável ou quando a preocupação tiver sido resolvida de forma conclusiva.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
I'm concerned that withCreateProcess may fail to clean up if an async exception is received at just the wrong time. I do not have a test case to prove it, but my reasoning follows.
See Control.Exception's discussion of "Interruptible operations". The masking of async exceptions by bracket when cleanupProcess is running only prevents non-interruptable operations from receiving an async exception. So if any operation in cleanupProcess turns out to be interruptable, an async exception received during that operation will prevent the rest of it from running.
Looking at the operations that get run, there's a takeMVar, but I think the MVar is always full, so it's not interruptable. Then it closes the IO handles, and as far as I can see, hClose is interruptable, or at least is not documented not to be.
So, an async exception received just as hClose is run will terminate the thread, and waitForProcess will never wait on the process. (IO handles could also potentially be left open, although generally GC will auto-close them when they go out of scope.) It's probably a rather narrow race condition.
My analysis could be wrong, but eh, if I've been staring at this code for an hour and I don't know if it it's correct, it seems like it would be a good idea to make sure this doesn't happen by using uninterruptibleMask somewhere?
(The closest I have come to a test case is modifying cleanupProcess to add threadDelay 100, and then it's easy to time the async exception to interrupt it, leaving the process running. But of course it might be threadDelay itself that's the interruptable operation in that case.)
- Linguagem predominante
- Haskell
- Estrelas
- 91
- Forks
- 93
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de haskell/process
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
-
HAVE_PIPE2 at compile time but not at runtime causes segfault on macOSTalvez já em andamento @alt-romes assumiu há 3 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
-
posix_spawn falls back to fork() when create_group = True due to HAVE_DECL_ macro mismatchTalvez já em andamento @lei-jia-xing assumiu há 11 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 57/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
Todas as issues de haskell/process
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
haskell/bytestring#730 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
seal-harness/seal-harness#399 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
fmidue/codeworld-tasks#124 ·
-
allow haskell-src-exts-1.24Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
reflex-frp/reflex#563 ·