Skip to content

Alpine 3.13 image is crashing on dotnet test #24189

Closed as not planned
Closed as not planned

Description

@ChaosEngine

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

  1. mthalman commented on Feb 18, 2021

    @mthalman
    Member

    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:

    using (var context = new ItemsContext(options))
    {
      context.Database.EnsureCreated();
    }

    The call to EnsureCreated is what causes the crash.

    Repro steps

    1. Unzip repro.zip to new folder
    2. docker build -t app .
    3. docker run --rm -it app

    I've also collected a crash dump:
    core.zip

  2. mthalman commented on Feb 18, 2021

    @mthalman
    Member

    Moving to efcore repo for further investigation.

  3. ajcvickers commented on Feb 19, 2021

    @ajcvickers
    Contributor

    @ericsink @bricelam Is SQLite expected to work on Alpine Linux?

  4. ericsink commented on Feb 19, 2021

    @ericsink
    Contributor

    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.

  5. ajcvickers commented on Mar 1, 2021

    @ajcvickers
    Contributor

    @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.

  6. ericsink commented on Mar 1, 2021

    @ericsink
    Contributor

    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.

  7. ajcvickers commented on Mar 1, 2021

    @ajcvickers
    Contributor

    Thanks @ericsink

  8. added this to the 6.0.0 milestone on Mar 1, 2021
  9. ericsink commented on Mar 1, 2021

    @ericsink
    Contributor

    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 ?

  10. mthalman commented on Mar 1, 2021

    @mthalman
    Member

    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.

    Did it successfully output created in the console? If not, then it crashed.

  11. ericsink commented on Mar 1, 2021

    @ericsink
    Contributor

    Ah, I see. No, it did not output created.

  12. 25 remaining items

  13. ektrah commented on Jul 12, 2021

    @ektrah
    Member
  14. ericstj commented on Jul 12, 2021

    @ericstj
    Member

    @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

  15. wfurt commented on Jul 12, 2021

    @wfurt
    Member

    Thanks @ericstj. So if we make rid update to add 3.14 it would be missed as well?

  16. ericstj commented on Jul 12, 2021

    @ericstj
    Member

    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

  17. ericstj commented on Jul 13, 2021

    @ericstj
    Member

    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

  18. ericstj commented on Jul 13, 2021

    @ericstj
    Member

    Here's another 5.0 RID change: dotnet/runtime#48203 I wonder if that has the same problem?

  19. dagood commented on Jul 13, 2021

    @dagood
    Member

    It looks like the Microsoft.NETCore.Platforms version 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 used 5.0.0 rather than $(ProductVersion), and that it was merged with a * NO MERGE * label active(explained in PR description).

    The Microsoft.NETCore.Platforms 5.0.0 package 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-x64 is also missing in a tar.gz I pulled for 5.0.7.

    /cc @dleeapho @NikolaMilosavljevic

  20. ericstj commented on Jul 13, 2021

    @ericstj
    Member

    Let's move this discussion to dotnet/runtime#50739. Let's make that a servicing issue and address it in the next release.

  21. removed this from the 6.0.0 milestone on Jul 14, 2021
  22. UsamaKhalil-KSO commented on Jul 18, 2021

    @UsamaKhalil-KSO

    faced the same issue today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions