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
{{ message }}
Repository navigation
[Operational Issue]: crossgen2 fails to start with Text file busy on Azure Linux cross-build legs #8079
Azure Linux cross-build legs intermittently fail while building Roslyn because crossgen2 cannot be started:
error MSB6003: The specified task executable ".../microsoft.netcore.app.crossgen2.linux-x64/9.0.18/tools/crossgen2" could not be run.
System.ComponentModel.Win32Exception (26): Text file busy
This occurred in 6 shipping builds / 7 build legs during the last 14 days across release/10.0.1xx and internal/release/10.0.1xx.
one possibility is that this is fixed in later versions of crossgen2 but we're still using version 9.0.18 in the roslyn build in 10.0.1xx for some reason
The failure is therefore not specific to Crossgen2 9.0.18, one target architecture, Alpine, or PGO.
In the analyzed failures, Crossgen2 never starts. The SDK’s RunReadyToRunCompiler task calls Process.Start, which immediately fails with Linux error 26, ETXTBSY:
System.ComponentModel.Win32Exception (26):
An error occurred trying to start process '.../tools/crossgen2'.
Text file busy
Most binlogs contain 89 failed starts from _CreateR2RImages. One contains 86 instances through the base ToolTask stack and another three through the RunReadyToRunCompiler override, still totaling 89. This indicates that a writable handle remains open for the duration of the R2R target, rather than this being a single transient launch collision.
Common restore behavior
Every sampled failing binlog has the same Language Server packaging sequence:
PackAllRids.targets invokes a nested Restore with runtime-pack downloads enabled.
That restore installs Microsoft.NETCore.App.Crossgen2.linux-x64 into Roslyn’s private package directory.
Several other requests for the same package wait for the package lock and then report:
Lock not required - Package already installed ...
After restore returns, PackAllRids.targets invokes RID-specific Pack builds using BuildInParallel="true".
The subsequent R2R operations cannot execute the newly installed Crossgen2 file.
For example, the older failures install both Crossgen2 8.0.29 and 9.0.18 during this restore. Build 3052625 installs 8.0.30 and 9.0.19.
A successful control build, 3050631, has the same restore/install sequence and completes successfully. Thus, installing Crossgen2 immediately before Pack creates the exposure window, but another timing-dependent event is required to trigger the failure.
Suspected descriptor-inheritance mechanism
NuGet’s Unix extraction implementation creates package files using libc creat():
creat() does not atomically set O_CLOEXEC. NuGet wraps the resulting descriptor in a SafeFileHandle and FileStream, but neither adds FD_CLOEXEC.
On Linux, package extraction defaults to the stream-copy path rather than mmap. Crossgen2 9.0.19 is the first large payload in its package and is approximately 12.4 MB, so NuGet holds a writable descriptor to the executable during that copy.
The proposed sequence is:
NuGet opens tools/crossgen2 for writing using creat().
While the copy is active, the same multi-node MSBuild process starts another worker or tool process.
The child inherits the writable descriptor.
Because the descriptor lacks FD_CLOEXEC, it survives the child’s execve.
NuGet finishes extraction and closes its own descriptor.
The child continues holding the writable descriptor.
Subsequent attempts to execute Crossgen2 fail with ETXTBSY until that child exits.
This is consistent with the general failure mode described in dotnet/runtime#58964.
NuGet’s package locking does not prevent this. The .nupkg.metadata marker is written only after extraction is complete, so the later “Package already installed” messages establish that NuGet itself completed the installation. They do not establish that no child inherited one of the extraction descriptors.
Why this appears limited to 10.0.1xx
The issue has only been observed on release/10.0.1xx and internal/release/10.0.1xx. It has not appeared on 10.0.4xx, despite 1xx and 4xx using the same .NET 10 runtime implementation.
The relevant branch difference is Roslyn’s packaging graph:
It explicitly restores R2R packs and then invokes RID-specific packs in parallel.
10.0.4xx removed this target as part of the newer Language Server packaging design in January 2026.
Both branches still contain NuGet’s creat() implementation, so the NuGet defect alone does not explain the branch restriction. The 1xx packaging graph supplies the timing and restore-to-R2R handoff needed to expose it.
The first observed failure followed the 10.0.110 bootstrap SDK update around July 14–15. No direct semantic change to NuGet extraction, Unix process creation, or the Roslyn R2R code was found in that update. It likely changed scheduling or timing enough to expose a longstanding race.
Potential mitigations
The most targeted Roslyn-only workaround would be:
After ResolveReadyToRunCompilers, copy the complete Crossgen2 tools directory to a RID/version-specific intermediate directory.
Replace @(Crossgen2Tool) with an item pointing to the copied executable while preserving its metadata.
Ensure the copy creates new files rather than hardlinks.
ETXTBSY is inode-specific, so a writable descriptor inherited for the package-cache executable would not affect the copied executable.
Another option is to perform the special restore in an isolated dotnet msbuild process using /m:1 /nr:false, wait for that process to exit, and then start the Pack builds.
The underlying fix should be in NuGet: create extracted Unix files atomically with O_CLOEXEC. Setting FD_CLOEXEC afterward with fcntl() would leave a smaller fork race between open and fcntl.
Analysis prepared with GitHub Copilot. Historical CI investigation used known-issue-history.
Activity
mmitche commentedon Aug 4, 2026
New matching occurrences:
crossgen2withText file busy.crossgen2withText file busy.Both match the tracked crossgen2 executable file-lock/race signature.
wtgodbe commentedon Aug 12, 2026
Another instance in https://dev.azure.com/dnceng/internal/_build/results?buildId=3045650&view=results
akoeplinger commentedon Aug 18, 2026
The build from main you mentioned (https://dev.azure.com/dnceng/internal/_build/results?buildId=3038492) doesn't show this issue from what I can see.
According to my Kusto queries this happened exclusively on release/10.0.1xx or internal/release/10.0.1xx in the last 90 days
akoeplinger commentedon Aug 18, 2026
one possibility is that this is fixed in later versions of crossgen2 but we're still using version 9.0.18 in the roslyn build in 10.0.1xx for some reason
akoeplinger commentedon Aug 20, 2026
Investigation findings
I inspected Roslyn binlogs from these occurrences:
The failure is therefore not specific to Crossgen2 9.0.18, one target architecture, Alpine, or PGO.
In the analyzed failures, Crossgen2 never starts. The SDK’s
RunReadyToRunCompilertask callsProcess.Start, which immediately fails with Linux error 26,ETXTBSY:Most binlogs contain 89 failed starts from
_CreateR2RImages. One contains 86 instances through the baseToolTaskstack and another three through theRunReadyToRunCompileroverride, still totaling 89. This indicates that a writable handle remains open for the duration of the R2R target, rather than this being a single transient launch collision.Common restore behavior
Every sampled failing binlog has the same Language Server packaging sequence:
PackAllRids.targetsinvokes a nestedRestorewith runtime-pack downloads enabled.That restore installs
Microsoft.NETCore.App.Crossgen2.linux-x64into Roslyn’s private package directory.Several other requests for the same package wait for the package lock and then report:
After restore returns,
PackAllRids.targetsinvokes RID-specificPackbuilds usingBuildInParallel="true".The subsequent R2R operations cannot execute the newly installed Crossgen2 file.
For example, the older failures install both Crossgen2 8.0.29 and 9.0.18 during this restore. Build 3052625 installs 8.0.30 and 9.0.19.
A successful control build, 3050631, has the same restore/install sequence and completes successfully. Thus, installing Crossgen2 immediately before Pack creates the exposure window, but another timing-dependent event is required to trigger the failure.
Suspected descriptor-inheritance mechanism
NuGet’s Unix extraction implementation creates package files using libc
creat():creat()does not atomically setO_CLOEXEC. NuGet wraps the resulting descriptor in aSafeFileHandleandFileStream, but neither addsFD_CLOEXEC.On Linux, package extraction defaults to the stream-copy path rather than mmap. Crossgen2 9.0.19 is the first large payload in its package and is approximately 12.4 MB, so NuGet holds a writable descriptor to the executable during that copy.
The proposed sequence is:
tools/crossgen2for writing usingcreat().FD_CLOEXEC, it survives the child’sexecve.ETXTBSYuntil that child exits.This is consistent with the general failure mode described in dotnet/runtime#58964.
NuGet’s package locking does not prevent this. The
.nupkg.metadatamarker is written only after extraction is complete, so the later “Package already installed” messages establish that NuGet itself completed the installation. They do not establish that no child inherited one of the extraction descriptors.Why this appears limited to 10.0.1xx
The issue has only been observed on
release/10.0.1xxandinternal/release/10.0.1xx. It has not appeared on 10.0.4xx, despite 1xx and 4xx using the same .NET 10 runtime implementation.The relevant branch difference is Roslyn’s packaging graph:
PackAllRids.targets.creat()implementation, so the NuGet defect alone does not explain the branch restriction. The 1xx packaging graph supplies the timing and restore-to-R2R handoff needed to expose it.The first observed failure followed the 10.0.110 bootstrap SDK update around July 14–15. No direct semantic change to NuGet extraction, Unix process creation, or the Roslyn R2R code was found in that update. It likely changed scheduling or timing enough to expose a longstanding race.
Potential mitigations
The most targeted Roslyn-only workaround would be:
ResolveReadyToRunCompilers, copy the complete Crossgen2toolsdirectory to a RID/version-specific intermediate directory.@(Crossgen2Tool)with an item pointing to the copied executable while preserving its metadata.ETXTBSYis inode-specific, so a writable descriptor inherited for the package-cache executable would not affect the copied executable.Another option is to perform the special restore in an isolated
dotnet msbuildprocess using/m:1 /nr:false, wait for that process to exit, and then start the Pack builds.The underlying fix should be in NuGet: create extracted Unix files atomically with
O_CLOEXEC. SettingFD_CLOEXECafterward withfcntl()would leave a smaller fork race betweenopenandfcntl.JulieLeeMSFT commentedon Sep 16, 2026
@mmitche, this issue still reproduces in https://dev.azure.com/dnceng/internal/_build/results?buildId=3072781&view=results. Checking if we need to reopen it.
mmitche commentedon Sep 16, 2026
Yep, should reopen it. The fix was not applied.
akoeplinger commentedon Sep 16, 2026
The fix was merged to nuget-client
devbranch in NuGet/NuGet.Client#7643, but not yet into a branch that is used in 10.0.1xx.