Skip to content

[Tests] GetProcessTmpDir_ChildProcess_ReadsTmpdir fails with Assert.Equal() Failure #5750

Description

@mdh1418

The GetProcessTmpDir_ChildProcess_ReadsTmpdir unit test (introduced in #5735) fails intermittently on the Ubuntu 22.04 x64 CI leg. The test spawns a child process with TMPDIR=/custom/tmp/test via ProcessStartInfo.Environment, then verifies that GetProcessTmpDir reads
the custom value from /proc/{pid}/environ.

Failure

Assert.Equal() Failure: Strings differ ↓ (pos 1) Expected: "/custom/tmp/test" Actual: "/tmp/" ↑ (pos 1)

The environ file was successfully read (environReadable = true), but the parsed TMPDIR was /tmp/ (the Path.GetTempPath() fallback) instead of the custom value set via ProcessStartInfo.Environment.

Possible Causes

  • Race condition: The child process's /proc/{pid}/environ may not reflect the overridden environment if read before execve completes
  • Empty environ: Some CI configurations may return readable but empty /proc/{pid}/environ
  • Environment propagation: ProcessStartInfo.Environment override may not propagate in certain CI environments

Activity

  1. steveisok commented on Mar 14, 2026

    @steveisok
    Member

    Additional data from rolling CI analysis:

    This also reproduces on Alpine 3.19 x64, not just Ubuntu 22.04. Same exact failure — Assert.Equal expecting /custom/tmp/test, getting /tmp/. Seen in:

    • Build 1332642 (Mar 12, Alpine3_19_x64_Release)
    • Build 1322735 (Mar 5, Ubuntu_22_04_x64_Release)

    Possible race condition: The test has no delay between Process.Start(psi) and calling GetProcessTmpDir(child.Id, ...). On Linux, /proc/{pid}/environ may not immediately reflect the child's environment if the read happens between fork() and exec(). A short polling loop or delay after start may help.

    Note: the #5751 diagnostics have not yet triggered on these legs because the most recent builds (1332940) are dominated by the SOS DAC loading failure (#5757), which masks this test.

  2. hoyosjs commented on Mar 28, 2026

    @hoyosjs
    Member

    Extended error message:

    Expected '/custom/tmp/test' but got '/tmp/'.
    Child PID: 16253,
    child exited: False,
    environ path: /proc/16253/environ,
    environ permissions: UserRead,
    parent TMPDIR: '(not set)',
    psi.Environment TMPDIR: '/custom/tmp/test',
    current user: cloudtest_azpcontainer,
    environ size: 0 bytes,
    env var count: 0,
    TMPDIR entry: '(not found)',
    first 200 chars of environ: ''
    
  3. locked and limited conversation to collaborators on May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions