You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Only one Dev Proxy instance should be the system proxy, but foreground starts and reloads can take it over #2203
Only one Dev Proxy instance should be registered as the system proxy at a time. If another live instance already is, starting a new one as the system proxy should fail with an error.
Today this is only enforced for detached starts (DevProxy/Program.cs:63-78, using StateManager.FindSystemProxyInstanceAsync). Foreground starts don't check it, and neither does re-registering during a hot-reload restart. So a second instance can take over the system proxy, and SystemProxyManager has code that tolerates this (SystemProxyManager.cs:116, and the FindLiveSystemProxyOwnerAsync docs at line 584: "the latest instance to take over the system proxy rewrites it").
Expected behaviour
Every start path that would register the system proxy (detached, foreground, and hot-reload re-registration) fails with the same error when another live process owns the system proxy, for example "Dev Proxy is already running as system proxy (PID: …). Use 'devproxy stop' to stop it first." The owner check should cover both foreground and detached owners, for example via the snapshot's owning PID (FindLiveSystemProxyOwnerAsync). Leftovers from crashed instances should still be handled by orphan recovery rather than blocking.
Actual behaviour
A foreground instance started with --as-system-proxy true registers as the system proxy even while another live instance owns it, overwriting the snapshot and taking over.
Steps to reproduce
On macOS or Windows, run devproxy in the foreground as the system proxy.
In another terminal, run a second devproxy in the foreground as the system proxy, on a different port.
The second instance registers and takes over instead of failing.
Dev Proxy Version
main
Operating system (environment)
macOS
Shell
zsh
Configuration file
N/A
Additional Info
Came up while reviewing #2149. That PR is being changed so that a hot-reload never takes the system proxy back from another owner. This issue covers enforcing the single-owner rule across all start paths.
Activity
Allow only one Dev Proxy instance to be the system proxy (dotnet#2204)