Skip to content

SignTool: Process.WaitForExit() calls can block indefinitely #16517

@MichaelSimons

Description

@MichaelSimons

Summary

Several process execution call sites in Microsoft.DotNet.SignTool use Process.WaitForExit() without a timeout, which can block indefinitely if the child process hangs. This could cause signing builds to hang with no diagnostics.

Affected Locations:

All in src/Microsoft.DotNet.SignTool/src/:

File Method What it runs
ZipData.cs RunPkgProcess dotnet exec for pkg tool
ZipData.cs RunTarProcess dotnet exec for tar tool (.NET Framework)
ZipData.cs RunExternalProcess bash for cpio/RPM operations
BatchSignUtil.cs RunWixTool cmd /c for WiX tools

Note: RealSignTool.RunMSBuild already handles this correctly using a configurable _dotnetTimeout with process.Kill() on timeout.

Suggested Approach

Consider consolidating process execution into a shared utility with:

  • Configurable timeout (with a sensible default)
  • Kill + wait on timeout
  • Consistent logging of command, stdout, stderr, and exit code
  • Consistent error reporting

The existing Microsoft.Arcade.Common.Command / ICommand utility could be extended with timeout support (it also calls WaitForExit() without a timeout today), or the proven pattern from RealSignTool.RunMSBuild could be extracted into a reusable helper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions