State/liveness keyed on PID alone is vulnerable to PID reuse
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Empieza leyendo DevProxy/State/StateManager.cs, especialmente IsProcessRunning, LoadStateFromFileAsync y GetOrphanedSystemProxyStatesAsync; después inspecciona DevProxy/State/ProxyInstanceState.cs para entender los datos del archivo de estado. Sigue cómo los comandos de instancias desconectadas utilizan la vigencia del PID. Se considera terminado cuando se rechaza el estado obsoleto si se ha reutilizado un PID, mientras las instancias legítimas siguen reconociéndose.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
Dev Proxy tracks detached instances by PID alone (state-<pid>.json), and StateManager determines whether an instance is "alive" purely by checking whether a process with that PID currently exists (StateManager.IsProcessRunning(int pid) → Process.GetProcessById).
Operating systems recycle PIDs. After an instance exits (cleanly or via crash), its PID number can be reassigned to a completely unrelated process. When that happens:
IsProcessRunning(pid)returnstruefor the stale state record, so Dev Proxy believes its old instance is still alive.- Commands that key on liveness (
stop,status,LoadAllStatesAsync,FindSystemProxyInstanceAsync, and the crash-recovery / orphaned-system-proxy reconciliation added in thestop --forcefix) can act on — or refuse to act on — the wrong process.
This is a pre-existing, low-probability correctness issue in the whole detached-instance design; it is independent of any single command.
Suggested fix
Store additional identity beyond the PID in the state file and verify it before treating a PID as "our" live instance. Options:
- Persist the process start time (
Process.StartTime) alongside the PID, and inIsProcessRunningcompare the running process's start time to the recorded value — a mismatch means the PID was reused and the record is stale. - Optionally also persist the process name / a Dev Proxy marker as a secondary check.
Process.StartTime is available cross-platform in .NET and is the standard, low-cost way to disambiguate PID reuse.
Notes
- Found while implementing the fix for #1731 (
devproxy stop --forcecannot restore the system proxy after a crashed instance). That fix relies onasSystemProxystate records to reconcile orphaned system-proxy registrations; PID-reuse hardening would make that reconciliation (and all liveness checks) more robust but is intentionally out of scope for that change. - Affected code:
DevProxy/State/StateManager.cs(IsProcessRunning,LoadStateFromFileAsync,GetOrphanedSystemProxyStatesAsync),DevProxy/State/ProxyInstanceState.cs.
- Lenguaje dominante
- C#
- Estrellas
- 832
- Forks
- 90
- Merge medio
- 14 h 14 min
- PR fusionados (30 d)
- 45
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/dev-proxy
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
MockStdioResponsePlugin: @stdin.body.id placeholder fails to resolve when messages arrive back-to-back after an id-less messageQuizá libre de nuevo @garrytrinder la tomó hace 90 días y no hay ningún pull request abierto. Abierto
dotnet/dev-proxy#1757 · 1 reacción · 2 asignados ·
Los mantenedores suelen responder en 1 día
-
needs peer review
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
dotnet/dev-proxy#1667 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Redirect/forward PluginAbiertoneeds spec question
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
dotnet/dev-proxy#1649 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de dotnet/dev-proxy
Issues similares
-
Bug: Hidden loading rings keep the compositor running, so Files uses 7-94% of a CPU core while idleAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
files-community/Files#19026 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Physgun SFX SpamAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
SubtitleEdit/subtitleedit#15946 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
BHoM/Civil3D_Toolkit#118 ·
-
Reason-phrase table has misspelled entries (`Unathorized`, `Switching Protcols`, `Multiple Choises`)Abiertobug severity:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100