Skip to content

[MEDIUM] GetPortOwner leaks Process handles on failed start diagnostics #133

Description

@Daliys

Problem

GetPortOwner creates a Process for lsof/netstat diagnostics and never disposes it.

Evidence

  • Editor/MCPServer.Utils.cs:44 creates var p = new Process().
  • macOS/Linux and Windows branches start/read/wait on the process.
  • No using, Dispose, or Close is called.

Impact

Repeated failed server starts while a port is occupied leak Process wrappers and redirected stdout handles.

Suggested fix

Wrap the Process in using so handles are released after each owner lookup.

Source report

Imported from audit report item: resource-leak (9) / Editor/MCPServer.Utils.cs:44.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageImported or reported issue awaiting owner reviewpriority: mediumImportant defect or workflow gap with workaroundsurface: networkingHTTP, WebSocket, listener, origin, or authentication surfacesurface: unity-editorUnity Editor package, windows, menus, or C# server surfacetype: resource-leakProcess, stream, handle, or lifecycle leak/hang risk

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions