How to troubleshoot exit code 139 in dotnet core 3.1 container on a Mac M1?

Viewed 1115

I recently got an M1 Mac powerbook, thinking that I could code in C# on dotnet core 3.1. My previous development environment was Windows 10 where we used linux containers.

I can build and start my containers without issue. But when I use them the main api host dies with error 139. The docker community says this is a segmentation fault.

Based on the log, the code is making a rest call to Google for Recaptcha.

_logger.LogInformation("About to call rest api on {RecaptchaVerificationEndpointV2}");
var response = await _restClient.ExecuteAsync(request);
_logger.LogInformation("Called rest api");          

The log has "About to call..." but not "Called...". This is the first call outside the container's network.

My question is - how can I troubleshoot this?

I guess that either there is some incompatibility with the platform (e.g. that dotnet 3.1 has a limitation on arm64) OR a firewall is blocking the call.

The only information I have is the code 139. Which is shown both in docker and in rider: enter image description here

As background, I have dotnet 6.0.1 installed. Docker is current - 4.4.2 (73305).

The container that dies is based on this image:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base

I got the same result with mcr.microsoft.com/dotnet/core/aspnet:3.1.416-bullseye-arm64v8.

Everything I've read from MS says this should be supported. Based on https://docs.microsoft.com/en-us/dotnet/core/install/macos I tried installing libgdiplus.

When i try building for platform=linux/amd64, i get a different error:

#23 13.60 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c dotnet restore ./********.csproj]: exit code: 139

(project name removed).

2 Answers

I didn't find out what caused the container to crash with exit code 139, but upgrading to dotnet 6 resolved the issue. Now I base the image on mcr.microsoft.com/dotnet/aspnet:6.0.

Not sure if this will help anybody, but I got the same error when trying to build dotnet 3.1 with docker-compose on my new M1 Mac. I solved it by editing FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base to FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base I also got some suggestions using platform: linux/x86_64 in the compose file, but that did not work either.

Related