-
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
Connection between dockerized application and azure sql hangs after ef core upgrade to 3.1 #20316
Comments
Team, could you please help on troubleshooting this issue. |
@cheenamalhotra Could this be something with SqlClient? I think there have been some issues with Docker/Linux. |
May I know which linux docker image are you using in your application? I can try to test SqlClient connectivity in that image. |
Sure!
Untill installing ssh it's just a copy-paste from |
Just want to add that we also re-produced the issue in a Azure virtual machine made from Ubuntu Server 18.04 LTS where the following was done
Portable version of app deployed with ssh and the the issue was re-produce by running the application with the dotnet command |
Can you also share the version of Azure DB/server you're connecting to This doesn't seem right as we run CI tests in SqlClient from Ubuntu to Azure all the time! |
Can you also verify if you're able to connect to Azure DB using just SqlClient driver from both docker/Ubuntu VM? You can use this app for validation: |
I can't check that app right now - will do it tomorrow and come back with results. Let me jut specify one thing - it's not like we don't have the connection - we are able to truncate entire database from the code, then recreate it using migrations (we do it programatically). When seeding starts, worker always creates some objects in database before it hangs. We even thought the issue could be caused by too large transaction because at first we had entire seeding (that lasted like 2 minutes locally) implemented as one huge db transaction; but after making the seeding create a separate transaction for each object inserted into db, the problem wasn't solved. I'm thinking if it was possible to somehow use ef core's source for our application (it would be much easier if the issue was reproducable on developer's desk) to actually add more logs and see where exactly it hangs (apparently it's not a blocking call because our applications still send heartbeats to rabbitmq and so on). |
Thanks @Arcanst I think this would then fall back to @ajcvickers for EF side of investigations first. As @Arcanst mentioned, this doesn't look like connection problem but in a particular flow with EF Core APIs. I think you can take over from here to reproduce the problem and if it turns out to be with one of SqlClient API flows, please let us know with a repro. :) Best Regards, |
@ajcvickers We could provide a repro project that would be a stripped down version of our application solution. Still it would be quite big and we would have to put a significant effort into doing this so before we do so we would prefer to have confirmation from you that it actual would be useful/necessary for you to identify root cause. |
EF Core can be built from source easily--see https://github.com/dotnet/efcore/blob/master/docs/getting-and-building-the-code.md You can build NuGet packages locally with
I don't have any ideas as to what is going on here, so I can't be certain that we will be able identify the root cause even if we can reproduce the issue. That being said, it certainly seems unlikely that we will be able to root cause this without being able to reproduce it. If you don't want to post the code publicly, then feel free to send it to avickers at microsoft.com. @AndriySvyryd @roji Any ideas here? |
What version of |
|
Upgrading to to Microsoft.Data.SqlClient to 1.1.1 solved the issue which now can be closed - thanks |
Please reconsider taking M.D.S. 3.1.1 in a 3.1 patch release. |
@ErikEJ We discussed it before, but this is certainly another data point. |
Filed #20378 to track updating the dependency. |
Our solution consists of almost 40 projects, 6 of them are runnable applications. In the simplest scenario we only need two applications running - webapi and worker which communicate through rabbitmq in a command-commandhandler pattern. We use .netcoreapp3.1 (to which we recently migrated from 2.2) and ef core 3.1 (to which we migrated afterwards). After ef core migration we encountered a strange issue - our worker app just stops executing code at random place during our custom made seeding (and we can't really do anything without seeding so that's as far as we got as it comes to commands). There is no exception, no timeout, the last log we see from worker is always saying
EFStatementsLogger.Log : EFInfo=[Executing DbCommand
and the sql query showed in the log is never seen in the Azure Data Studio profiler so it never reaches the database. The query at which the application stops changes from seeding to seeding, there is no rule and we've been trying to find the source for 2 weeks now.We narrowed down the issue to linux + efcore 3.1, let me quickly walk you through the investigation (tests were done repeatedly and the results were consistent):
We were able to narrow down the commits that could've caused the issue to six and two of them are pure migrations (we flattened a huge number of migrations into one - twice during that task). 90% changes in these four commits are about ef core's fluent api that wasn't working after ef core upgrade, indexes, includes, custom projections (nothing big - mostly changes like replacing
string.Equals(a, b, StringComparison.CurrentCultureIgnoreCase);
witha.ToLower() == b.ToLower();
).I could provide you with the diff from these four commits if you'd like but it's going to be a big one.
Our setup (that's been working for over a year now on ef core 2.*):
The issue is quite annoying and made us move back to windows apps on azure (where everything works just as it did before ef core upgrade). Since our solution is huge, there is no possibility to make a small POC project. We went through all breaking changes a few times but didn't notice anything wrong. Could you point us in any direction here? Any hint, any place worth checking? Anything you need will be supplied.
The text was updated successfully, but these errors were encountered: