Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 8.0.401 + macOS crashes, while .NET 8.0.303 doesn't. #106661

Open
jonpryor opened this issue Aug 19, 2024 · 5 comments
Open

.NET 8.0.401 + macOS crashes, while .NET 8.0.303 doesn't. #106661

jonpryor opened this issue Aug 19, 2024 · 5 comments

Comments

@jonpryor
Copy link
Member

jonpryor commented Aug 19, 2024

Description

.NET 8.0.401 + macOS crashes, while .NET 8.0.303 doesn't.

Reproduction Steps

Alas, not minimal:

# Repro is from building the dotnet/java-interop repo
git clone https://github.com/dotnet/java-interop.git
cd java-interop
git checkout fcad3368815dffd0f38f64384aa21b0b65367d68
git submodule update --init --recursive


# ensure .NET 8.0.401 is used
export PATH=$HOME/Downloads/dotnet-sdk-8.0.401-osx-x64:$PATH

# prepare
dotnet build -t:Prepare Java.Interop.sln

# build
dotnet build Java.Interop.sln

Expected behavior

Build completes without error.

Note: requires that dotnet/java-interop dependencies already exist, which includes a C++ toolchain, Java SDK, etc.…

Actual behavior

Fails to build:

tmp7adcfcd1012f44439ffd2772eea8f2e1.exec.cmd: line 2: 89333 Segmentation fault: 11  "…/dotnet-sdk-8.0.401-osx-x64/dotnet" "…/java-interop/bin/Debug-net8.0//jnimarshalmethod-gen.dll" "…/java-interop/samples/Hello-NativeAOTFromJNI/bin/Debug/Hello-NativeAOTFromJNI.dll" -v -v --keeptemp -L "…/java-interop/samples/Hello-NativeAOTFromJNI/bin/Debug/"
…/java-interop/samples/Hello-NativeAOTFromJNI/Hello-NativeAOTFromJNI.targets(44,5): error MSB3073: The command ""…/dotnet-sdk-8.0.401-osx-x64/dotnet" "…/java-interop/bin/Debug-net8.0//jnimarshalmethod-gen.dll" "…/java-interop/samples/Hello-NativeAOTFromJNI/bin/Debug/Hello-NativeAOTFromJNI.dll" -v -v --keeptemp -L "…/java-interop/samples/Hello-NativeAOTFromJNI/bin/Debug/" " exited with code 139. […/java-interop/samples/Hello-NativeAOTFromJNI/Hello-NativeAOTFromJNI.csproj]

Re-run with diagnostic logging enabled:

dotnet build -v:diag Java.Interop.sln > b.txt

and there isn't much additional output regarding the crash.

Regression?

Yes. This same repo builds with .NET 8.0.303. See also: dotnet/java-interop#1245

Known Workarounds

Use .NET 8.0.303.

Configuration

  • .NET 8.0.401
  • macOS Sonoma 16.4.1
  • x64
  • No idea if it's specific to this configuration
  • Not using Blazor

Other information

This doesn't appear to fail on Linux-x64.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Aug 19, 2024
@jonpryor
Copy link
Member Author

Note: you may need to run dotnet build Java.Inteorp.sln more than once to get to the crash. I've also seen this error, which doesn't repro:

…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018: The "GenerateRuntimeConfigurationFiles" task failed unexpectedly. […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018: System.IO.IOException: The process cannot access the file '…/java-interop/bin/BuildDebug-net8.0/jnienv-gen.runtimeconfig.json' because it is being used by another process. […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Int64& fileLength, UnixFileMode& filePermissions) […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException) […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at System.IO.File.Create(String path) […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.WriteToJsonFile(String fileName, Object value) […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.WriteRuntimeConfig(RuntimeFramework[] runtimeFrameworks, LockFileTargetLibrary platformLibrary, Boolean isFrameworkDependent, IList`1 packageFolders) […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.ExecuteCore() […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]
…/dotnet-sdk-8.0.401-osx-x64/sdk/8.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(379,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) […/java-interop/build-tools/jnienv-gen/jnienv-gen.csproj]

I'm not (currently) reporting this MSB4018 from GenerateRuntimeConfigurationFiles.

jonpryor pushed a commit to dotnet/java-interop that referenced this issue Aug 20, 2024
Context: dotnet/runtime#106661

Beginning with .NET 8 8.0.400, we hit the following error on CI:

	/var/folders/cy/09t6wxdj6qn64c5q9_kr6czr0000gn/T/MSBuildTemprunner/tmp58b6b197481a4eb7b080ec79e70515ad.exec.
	cmd: line 2:  7199 Bus error: 10           "/Users/runner/hostedtoolcache/dotnet/dotnet" 
	"/Users/runner/work/1/s/bin/Release-net8.0//jnimarshalmethod-gen.dll" "/Users/runner/work/1/s/samples/Hello-
	NativeAOTFromJNI/bin/Release/Hello-NativeAOTFromJNI.dll" -v -v --keeptemp -L "/Users/runner/work/1/s/samples/Hello-
	NativeAOTFromJNI/bin/Release/"

	##[error]samples/Hello-NativeAOTFromJNI/Hello-NativeAOTFromJNI.targets(44,5): Error MSB3073: The command 
	""/Users/runner/hostedtoolcache/dotnet/dotnet" "/Users/runner/work/1/s/bin/Release-net8.0//jnimarshalmethod-gen.dll" 
	"/Users/runner/work/1/s/samples/Hello-NativeAOTFromJNI/bin/Release/Hello-NativeAOTFromJNI.dll" -v -v --keeptemp -L 
	"/Users/runner/work/1/s/samples/Hello-NativeAOTFromJNI/bin/Release/" " exited with code 138.

Pin to .NET '8.0.303' for now while this regression is investigated
and fixed in .NET.
@agocke
Copy link
Member

agocke commented Sep 11, 2024

@AaronRobinsonMSFT Did we make any servicing fixes that could have caused this?

@agocke agocke added this to AppModel Sep 11, 2024
@jkotas
Copy link
Member

jkotas commented Sep 11, 2024

This might have been introduced by #104818 and fixed by #107199 .

cc @janvorli

@janvorli
Copy link
Member

If the crash occurs only under Rosetta and not on a real x64 macOS and there is some hardware exception handling going on, this could be what @jkotas said.

@agocke agocke added this to the 8.0.x milestone Sep 16, 2024
@agocke agocke removed the untriaged New issue has not been triaged by the area owner label Sep 16, 2024
@jonpryor
Copy link
Member Author

@janvorli wrote:

If the crash occurs only under Rosetta and not on a real x64 macOS … this could be what @jkotas said.

I was experiencing this on an x64 macOS machine. No arm64, no Rosetta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants