-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using EF & SQLite crashes in alpine asp.net core 2.2 (but not 2.1) runtime docker image with Segmentation Fault (aka silently) #14504
Comments
Confirmed. Just using Microsoft.Data.Sqlite seems to work fine, but something about EF Core is causing the process to terminate early. The last things logged (by both EF Core and SQLite) are:
|
I have same/similar issue. Not using EF just Microsoft.Data.Sqlite. I can read from the database but once the application starts writing is crashes. For now moved away from the alpine image which seams to work fine. |
We are using Sqlite for our automated tests using Docker with microsoft/dotnet:2.2-sdk-alpine. Same tests work fine with microsoft/dotnet:2.1-sdk-alpine. |
@ericsink this looks like a problem (or missing dependency) with e_sqlite3 on the <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.11"/>
</ItemGroup>
</Project> using System;
using System.Diagnostics;
using static SQLitePCL.raw;
class Program
{
static void Main()
{
SQLitePCL.Batteries_V2.Init();
Console.WriteLine("Opening database...");
var rc = sqlite3_open("test.sqlite3", out var db);
Debug.Assert(rc == SQLITE_OK);
Console.WriteLine("Creating schema...");
rc = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS test(value)");
Debug.Assert(rc == SQLITE_OK);
Console.WriteLine("Done");
}
} Output:
|
Quick reply to acknowledge I've seen this: First I'll take a look at the alpine-specific parts and see if I can find something that looks wrong. I don't currently have anything setup for testing that configuration, but I can pursue that if I need to. |
So it's broken on 2.2 but not 2.1. Do you know what SQLitePCLRaw versions correspond to those versions? From your example above, it looks like it's broken in my 1.1.11. I'm trying to figure out in which version of SQLitePCLRaw the alpine linux build was last working. If ever. But I assume it was at one point, as I recall somebody reporting so. |
It worked on the older 2.1 Docker images (e.g. microsoft/dotnet:2.1-sdk-alpine), but broke in the 2.2 images. They may have removed or updated some dependency. @divega Do we have a contact for the Docker images that can also take a look? |
We are using the NuGet package for getting SQLite (can’t remember which and version) and version is kept. |
@glennc We think this is likely an issue with the 2.2 Alpine docker image. Do you know who would be a good person to contact about this? |
@richlander This is the issue I mentioned. It looks like it is a issue with the alpine docker image for 2.2 that could be a regression from 2.1. Can you recommend someone to help investigate? |
Do these libraries depend on any native code (besides .NET Core itself)? |
Yes, they depend on https://www.nuget.org/packages/SQLitePCLRaw.core/ which pulls in the native SQLite library. |
If it depends on glibc, then it probably won't work. Alpine uses musl. Why the scenario worked in 2.1 and not 2.2, I don't know. Has anyone run the scenario under a native debugger to at least produce a good error message? |
Those SQLite builds are specifically built for musl. |
Let me try to repro it locally to see where it crashes. |
It looks like the source of the regression is related to the version of Alpine being used. Note that 2.1 .NET image ships on Alpine 3.7 while 2.2 ships on Alpine 3.8. I did the following quick test with the provided repro steps. The seg fault does not occure with
|
I've tried to run the repro as described at the beginning of this github issue. It has crashed in /app/runtimes/linux-x64/native/libe_sqlite3.so. Looking at the library dependencies, it is obvious that it was built for glibc and not musl:
|
It seems that the issue may be caused by the fact that the alpine.3.8 rid is not present in the |
Oh my. If that lib was built for libc, does that mean I screwed up the musl build? If so, I'm wondering how this ever worked. Or wait -- looking at your latest comment, is it that the wrong lib is somehow getting included? |
@ericsink - I don't think it is your fault. Modifying the |
Related to https://github.com/dotnet/corefx/issues/34316 which added Alpine 3.8 and 3.9 to the rid graph. |
Ah, this is making more sense now. Thanks. |
@MichaelSimons Since that was fixed in 2.2.3, should this issue be fixed by using the latest 2.2 SDK and runtime? |
I was thinking it should but I see the Microsoft.NETCore.App/2.2.3/Microsoft.NETCore.App.deps.json doesn't include alpine 3.8 or 3.9. @joperezr - can you answer why? |
That would be determined by the version of Microsoft.NETCore.Platforms used when building the shared framework in core-setup. 2.1 is using 2.1.3 2.2 is using 2.2.0 If I crack open the 2.2.0 package it doesn't have alpine3.8 or 3.9, it was built prior to those changes. It looks to me like a new version of Microsoft.NETCore.Platforms was never shipped from release/2.2 after it's initial release in November. @wtgodbe do you know if anything is tracking updating the platforms package in release/2.2? |
I didn't realize that we'd shipped a version of |
@wtgodbe @ericstj @danmosemsft @livarcocc Looks like the root cause of this is below EF. Where would be a good place to continue tracking this issue? |
The solution would be either to ship the package out of both 2.x branches in CoreFx, or to have Core-Setup 2.2 consume the latest 2.1 version of the package. Therefore we should probably track it in CoreFx, I'll open an issue there & close this one. |
https://github.com/dotnet/core-setup/issues/5562 (I can't close issues in this repo, so I'll leave that to someone who has permissions) |
Thanks @wtgodbe |
Any solution here? |
@WeihanLi This issue has been closed as "external". If you want to continue to follow the progress on or add information to this issue, then please follow the link above to the new location. If you would like to report a different problem, then please file a new issue and include a small, runnable project/solution or complete code listing that demonstrates the behavior you are seeing. |
Segmentation fault when using EF Core and Sqlite in official alpine 2.2 runtime docker image from microsoft. Can be easily reproduced with a standard example project from microsoft.
Steps to reproduce the issue
Expected behavior
Application runs without Segmentation Fault crash
Actual behavior
Segmentation Fault crash
Additional information
Output of
docker version
Client: Docker Engine - Community
Version: 18.09.1
API version: 1.39
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:34:26 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.1
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:41:49 2019
OS/Arch: linux/amd64
Experimental: false
The text was updated successfully, but these errors were encountered: