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
WSL plugin DLLs are moved out of wslservice.exe into a separate
wslpluginhost.exe COM server so plugin code can no longer crash or
destabilize the service. Each plugin is activated in its own host
process (CLSCTX_LOCAL_SERVER, SYSTEM-only via AppID) and reached
through a versioned COM interface defined in WslPluginHost.idl. All
hosts are tied to a service-owned job object and terminate when
wslservice exits. The plugin API is unchanged; existing plugins run
unmodified.
A crashing or disconnected host is classified by IsHostCrash
(RPC_E_DISCONNECTED, RPC_E_SERVER_DIED[_DNE], CO_E_OBJNOTCONNECTED,
RPC_S_SERVER_UNAVAILABLE, RPC_S_CALL_FAILED[_DNE]); the service logs
it and continues instead of treating it as a fatal plugin error.
RPC_E_CALL_REJECTED is intentionally excluded as a transient busy
state rather than a dead host.
Plugin->service callbacks (MountFolder, ExecuteBinary, and the WSLC
session APIs) arrive on a different COM thread than the outbound hook,
so they cannot re-enter the lock held during the hook:
- VM path: LxssUserSessionImpl guards callbacks with a shared_mutex
(shared for callbacks, exclusive in _VmTerminate after OnVmStopping
drains in-flight callbacks before the utility VM is destroyed).
- WSLC path: PluginManager resolves sessions through its own
reference map under a dedicated lock, and WSLCSessionManager
releases its session lock before any plugin notification fires, so
callbacks never re-enter the session lock. A session is registered
in the reference map but not published until OnWslcSessionCreated
succeeds, so a vetoed or race-lost session is never handed out.
Proxy/stub is consolidated into wslserviceproxystub.dll. One new exe,
no new DLLs.
Tests
- HostCrashIsolation: kills wslpluginhost.exe mid-OnVmStarted and
verifies the service survives and m_initOnce stays sticky.
- ConcurrentCallbacks: four plugin threads hammer MountFolder and
ExecuteBinary, exercising the shared callback lock.
- AsyncApiCallFromWorker: a plugin worker thread calls into the
service post-hook (cross-apartment, non-COM-initialized).
- CallbacksDuringTerminationDoNotCrash: worker threads race
_VmTerminate's exclusive lock and VM teardown, then wind down
deterministically after OnVmStopping signals them and are joined on
the next session start.
- Existing WSL1 plugin tests broadened alongside the refactor.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments