Skip to content

Commit c247a84

Browse files
Ben HillisCopilot
andcommitted
Tear down the stale plugin Plan9 server before recreating it
When the per-user plugin Plan9 server is no longer running, the previous instance was dropped without a Teardown call, so it could still hold the Plan9 port when the replacement tries to bind it. Co-authored-by: Copilot <[email protected]> Copilot-Session: 0d028ad4-fe5e-4ef1-9832-18ee0e4825cc
1 parent de25862 commit c247a84

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎src/windows/service/exe/WslCoreVm.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,6 +2113,13 @@ void WslCoreVm::MountRootNamespaceFolder(_In_ LPCWSTR HostPath, _In_ LPCWSTR Gue
21132113
auto runAsUser = wil::impersonate_token(m_userToken.get());
21142114
if (!m_pluginPlan9Server || m_pluginPlan9Server->IsRunning() != S_OK)
21152115
{
2116+
// Tear down the previous server so it releases the port before the replacement binds it.
2117+
if (m_pluginPlan9Server)
2118+
{
2119+
LOG_IF_FAILED(m_pluginPlan9Server->Teardown());
2120+
m_pluginPlan9Server.reset();
2121+
}
2122+
21162123
auto server =
21172124
wsl::windows::common::wslutil::CreateComServerAsUser<p9fs::Plan9FileSystem, IPlan9FileSystem>(m_userToken.get());
21182125
THROW_IF_FAILED(server->Init(&m_runtimeId, LX_INIT_UTILITY_VM_PLAN9_PLUGIN_PORT));

0 commit comments

Comments
 (0)