Repository navigation
Description
Describe the Bug
Running dotnet test on Alpine 3.13 docker based image crashes test runner.
When running on mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 it succeeds
When running on mcr.microsoft.com/dotnet/sdk:5.0-alpine it fails
Steps to Reproduce
Dockerized repro based on https://github.com/dotnet/EntityFramework.Docs (https://github.com/dotnet/EntityFramework.Docs/tree/master/samples/core/Miscellaneous/Testing/ItemsWebApi/Tests specifically)
Start docker sdk alpine image
docker run -it --rm mcr.microsoft.com/dotnet/sdk:5.0-alpine
and then. execute this in interactive terminal..
#working project dir
cd /srv/
#I just need proper ll, c'mon
alias ll='ls -lah --color'
#usefull debugging and testing stuff
apk add --update vim strace gdb
#our repo to reproduce
git clone https://github.com/dotnet/EntityFramework.Docs.git
#working dir with tests
cd /srv//EntityFramework.Docs/samples/core/Miscellaneous/Testing/ItemsWebApi/Tests/
#build for restoring packages, simple.
dotnet build
#now tests - this crashes!!!!
dotnet test
#deeper investigation?
#strace dotnet test --logger trx --results-directory _temp -v m --blame-crash
#vim -p _temp/*.trx _temp/*/*.xml
Other Information
The same stuff when run with docker run -it --rm mcr.microsoft.com/dotnet/sdk:5.0-alpine works and just properly fails saying LocalDB is not avaialblre under Linux :-)
Output of docker version
Client:
Version: 19.03.15
API version: 1.40
Go version: go1.15.7
Git commit: 420b1d3625
Built: Thu Feb 4 20:43:34 2021
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 19.03.15
API version: 1.40 (minimum version 1.12)
Go version: go1.15.7
Git commit: 420b1d3625
Built: Thu Feb 4 20:43:19 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.3.9
GitCommit: ea765ab
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683b971d9c3ef73f284f176672c44b448662
Output of docker info
Client:
Debug Mode: false
Server:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 40
Server Version: 19.03.15
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ea765ab
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683b971d9c3ef73f284f176672c44b448662
Security Options:
seccomp
Profile: default
Kernel Version: 5.4.72-gentoo
Operating System: Gentoo/Linux
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 31.29GiB
Name: chaos2
ID: OUE5:YKZ7:KCDZ:CTG3:BDT2:KLUH:7BW4:FRYG:47XX:25NZ:F5AL:Y67R
Docker Root Dir: /mnt/samsung512GB/var/lib/docker
Debug Mode: false
Username: chaosengine
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Activity
mthalman commentedon Feb 18, 2021
I've confirmed it's a segfault crash. It occurs when calling
context.Database.EnsureCreated()when using a file-based connection for SQLite. So it seems to be related to Entity Framework or native implementation of SQLite. I saw that the db file does get created on the file system.I've created a simple repro project that doesn't involve
dotnet test. The crux of the repro is here:The call to
EnsureCreatedis what causes the crash.Repro steps
docker build -t app .docker run --rm -it appI've also collected a crash dump:
core.zip
mthalman commentedon Feb 18, 2021
Moving to efcore repo for further investigation.
ajcvickers commentedon Feb 19, 2021
@ericsink @bricelam Is SQLite expected to work on Alpine Linux?
ericsink commentedon Feb 19, 2021
Yes, it is supposed to work on Alpine linux. It seems like it breaks 1-2 times per year, usually due to something in the environment changing, IIRC.
ajcvickers commentedon Mar 1, 2021
@ericsink Is there anything we can do help understand the issue on Alpine? I don't think there is anything we can change on our end, unless I'm missing something.
ericsink commentedon Mar 1, 2021
Based on what I saw above, it looks like everything succeeded with Alpine docker image 3.12 and then failed with 3.13. So I had been assuming something changed in between that caused the break.
One possibility I have not investigated yet is that maybe "the thing that changed" would require me to build the alpine sqlite library differently, such as, for example, with a more recent compiler or C lib, etc.
I'll try the repro above and see if it yields any clues.
ajcvickers commentedon Mar 1, 2021
Thanks @ericsink
ericsink commentedon Mar 1, 2021
I tried the repro.zip above and it didn't fail. On the possibility that I did something wrong, one of my coworkers tried it, and no crash for them either.
Still quite possible we're doing the repro incorrectly somehow.
Can someone point me to a list of things that changed in the docker image between 3.12 and 3.13 ?
mthalman commentedon Mar 1, 2021
Did it successfully output
createdin the console? If not, then it crashed.ericsink commentedon Mar 1, 2021
Ah, I see. No, it did not output
created.25 remaining items
ektrah commentedon Jul 12, 2021
(See also dotnet/runtime#50739)
ericstj commentedon Jul 12, 2021
@Anipik's change dotnet/runtime@95fe690 did this. My best guess is that the runtime consolidation in 5.0 missed picking up the live built runtime.json and is using some restored copy (or SDK copy). cc @jkoritzinsky @ViktorHofer
wfurt commentedon Jul 12, 2021
Thanks @ericstj. So if we make rid update to add 3.14 it would be missed as well?
ericstj commentedon Jul 12, 2021
I didn't check that, but you could by examining the tar.gz file. 3.x was done in a different way (due to separate repos) and underwent a lot more additions that I expect would have noticed this, so I suspect the bug is not there. Can't know for sure until someone root-causes the deps file generation on 5.0. cc @dagood
ericstj commentedon Jul 13, 2021
I think I misread your statement as .NETCore 3.x, but you meant an addition to of 3.14 to 5.0. There's probably a way to make it work correctly. I would ask @dagood or @jkoritzinsky as they know the most about this part of the shared framework creation process. It looks to me like the 5.0 tools relied on getting the runtime graph from some package that was restored as part of the project: https://github.com/dotnet/arcade/blob/7e1e1ff990487b0c74e0fb17b4169bc5378fe778/src/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk/src/ProcessSharedFrameworkDeps.cs#L56-L57
ericstj commentedon Jul 13, 2021
Here's another 5.0 RID change: dotnet/runtime#48203 I wonder if that has the same problem?
dagood commentedon Jul 13, 2021
It looks like the
Microsoft.NETCore.Platformsversion was pinned to 5.0.0 by dotnet/runtime#43182 and it hasn't been updated since then to match the live version, so it faithfully continues to use 5.0.0. It seems odd to me that it used5.0.0rather than$(ProductVersion),and that it was merged with a(explained in PR description).* NO MERGE *label activeThe
Microsoft.NETCore.Platforms5.0.0package name/version shows up in the deps.json file, so I don't think it'll be hard to spot for specific tar.gzs. And yeah,fedora.35-x64is also missing in a tar.gz I pulled for 5.0.7./cc @dleeapho @NikolaMilosavljevic
ericstj commentedon Jul 13, 2021
Let's move this discussion to dotnet/runtime#50739. Let's make that a servicing issue and address it in the next release.
UsamaKhalil-KSO commentedon Jul 18, 2021
faced the same issue today.