Repository navigation
Description
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
- Install .NET 5.0 SDK
mkdir app && cd appdotnet new console --no-restore- Add a new file to the folder with the name
Dockerfileand 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"]sudo docker build -t test .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).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
MichaelSimons commentedon Jan 25, 2021
This is blocking Add support for Alpine 3.13.
janvorli commentedon Jan 27, 2021
I can repro the problem, however the Alpine 3.13 docker image (even the original alpine:3.13) has apk broken, so I cannot install a debugger. Trying to install e.g. gdb:
I've found multiple reports of the same issue with Alpine 3.13 while people say that 3.12 works fine. I get the same behavior. One of such report is here: https://www.gitmemory.com/issue/alpinelinux/docker-alpine/135/761709893.
I wonder how we have succeeded creating the mcr.microsoft.com/dotnet/nightly/runtime:5.0-alpine3.13-arm32v7 image then. @mthalman any idea?
mthalman commentedon Jan 27, 2021
We don't require
apkto produce theruntimeandaspnetimages because we don't install any additional packages. We just install the runtimes from .tar.gz files. However, we just started producingsdkimages for 6.0 on arm32 Alpine 3.13 and we do useapkfor that. Those builds are working fine. Here's build output:Correction:
We do use
apkfor theruntime-depsparent image thatruntimeis based on. That's obviously working as well.janvorli commentedon Jan 27, 2021
Ok, it was caused by an outdated docker. I've reinstalled it from the docker's own repo and now I am able to install packages.
janvorli commentedon Jan 27, 2021
Interestingly enough, after I've upgraded docker, your sample above started to work for me - it prints Hello World now instead of crashing:
janvorli commentedon Jan 27, 2021
My version of docker is now
mthalman commentedon Jan 28, 2021
@janvorli - I see you're running an arm64 machine. I'm using an arm32 machine (Raspberry Pi 4). I was using an older version of Docker (version 20.10.0). But even after upgrading it to 20.10.2, I still get the same crashing behavior.
janvorli commentedon Jan 28, 2021
Hmm, that's strange. I'll dig out my RPi 3 and see if I can repro it over there.
janvorli commentedon Feb 2, 2021
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.3 remaining items
janvorli commentedon Feb 4, 2021
I am hitting the same issue. Since it is also related to time (based on the exception), I was wondering if we are actually hitting another thing that the release notes mention for 32 bit platforms:
To check if it is the issue, I've built .NET Core 5 using crossbuild and Alpine 3.13 rootfs (it required several little hacks to get there). I've built it from the same commit as the runtime that was in the docker container. Then I've copied the files into /usr/share/dotnet/shared/Microsoft.NETCore.App/5.0.2 and the issue is gone.
That means that we need to build runtime for ARM Alpine >=3.13 on Alpine 3.13. This doesn't affect the x64 / arm64 Alpine, as the breaking change is 32 bit OS only.
karelz commentedon Feb 10, 2021
@janvorli what would be the right area path for the issue? PAL?
janvorli commentedon Feb 10, 2021
@karelz I would use meta, as the fix involves changes in rootfs build script in arcade, a patch to the pal.h header and change in the dotnet-buildtools-prereqs-docker repo.
mthalman commentedon Feb 24, 2021
What is the status of this? Is this something that can still get into Preview 2?
mthalman commentedon Jun 2, 2021
@janvorli - I'm still seeing the same failure as above on the upcoming 5.0.7 release. I believe this was the release you were expecting the fix to be in. Here's the output of
dotnet --infoin the environment which it fails in.janvorli commentedon Jun 2, 2021
My local verification in Alpine 3.13 armv7 docker container running on arm64 Linux with the test from above have worked fine.
janvorli commentedon Jul 23, 2021
Everything is working fine now.