runtime: Hello World app crashes on Arm32 Alpine 3.13

When attempting to run a .NET application on Arm32 Alpine 3.13, it crashes (core dump: core.zip).

This repros on both .NET runtime 5.0.2 and 6.0.0-alpha.1.21069.7.

This error does not happen when using the same architecture with Alpine 3.12. It also doesn’t happen when using Arm64 Alpine 3.13.

Repro

Steps are to be run on an Arm32 device with Docker installed

  1. Install .NET 5.0 SDK
  2. mkdir app && cd app
  3. dotnet new console --no-restore
  4. Add a new file to the folder with the name Dockerfile and the following content:
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim-arm32v7 as build

WORKDIR app
COPY *.csproj .
RUN dotnet restore

COPY . .
RUN dotnet build --no-restore


FROM build as publish
RUN dotnet publish --no-restore -c Release -o out


FROM mcr.microsoft.com/dotnet/nightly/runtime:5.0-alpine3.13-arm32v7
WORKDIR /app
COPY --from=publish /app/out ./
ENTRYPOINT ["dotnet", "app.dll"]
  1. sudo docker build -t test .
  2. sudo docker run --rm test

Expected: Outputs Hello World! Actual: App crashes

Another result

I also found that adding code that makes a web request results in a NotTimeValid cert error with this exception stack:

Unhandled exception. System.AggregateException: One or more errors occurred. (The SSL connection could not be established, see inner exception.)
 ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
 ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: NotTimeValid
   at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)
   at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at app.Program.Main(String[] args) in /app/Program.cs:line 9

You can repro this by modifying the Program.cs file that gets generated in the above repro steps to include the following code:

static void Main(string[] args)
{
    var task = new System.Net.Http.HttpClient().GetAsync("https://www.microsoft.com");
    task.Wait();
    task.Result.EnsureSuccessStatusCode();
}

This repos in the same environment as described above and also works in the other environments that were mentioned (Alpine 3.12, Arm64 Alpine 3.13).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (20 by maintainers)

Most upvoted comments

I have tried that on my Odroid XU4 (arm32 only device) with Ubuntu 20.04. The default docker reproed the issue, but after upgrading it to the one from the docker repo it worked fine (I had to use repo for bionic, as the one for focal didn’t contain armhf packages for some reason). This time the docker version was 20.10.3. I was googling a bit and found the alpine 3.13 release notes that describe a problem with time64 compatible system calls: https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.13.0#musl_1.2. When I have tried to run ping to any address (I’ve tried a numeric one) from inside of the container before installing the new docker, I was getting the following error: ping: clock_gettime(MONOTONIC) failed. That seems to indicate that the problem is related to the release notes paragraph. These notes also say that not only you have to have a docker >=19.03.9, but you also need to have libseccomp compatible with time64 installed on your host OS. You can check for that using scmp_sys_resolver -a arm clock_gettime64. If 403 is returned, time64 is supported. If -1 is returned, time64 is not supported.