-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
CPU intensive process left running after closing a winforms .Net6 app that uses OleDB #76054
Comments
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process Issue DetailsDescriptionCPU intensive process left running after closing a WinForms .Net6 app that uses OleDB. I am not the first person to experience this. Please see following StackOverflow questions C# WinForm - EXE not terminating when closing main form & Reading access database, background process still running on close. Reproduction StepsSample code attached WinFormsApp.zip. For the bug to be replicated, the exe must be opened outside of the visual studio environment. Expected behaviorAll processes would close on application exit. Actual behaviorProcess left running. Regression?This issue didn't happen in .Net framework as far I can tell but I didn't specifically test for it. Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Tagging subscribers to this area: @roji, @ajcvickers Issue DetailsDescriptionCPU intensive process left running after closing a WinForms .Net6 app that uses OleDB. I am not the first person to experience this. Please see following StackOverflow questions C# WinForm - EXE not terminating when closing main form & Reading access database, background process still running on close. Reproduction StepsSample code attached WinFormsApp.zip. For the bug to be replicated, the exe must be opened outside of the visual studio environment. Expected behaviorAll processes would close on application exit. Actual behaviorProcess left running. Regression?This issue didn't happen in .Net framework as far I can tell but I didn't specifically test for it. Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
I can confirm this indeed repros; however, changing the OleDB provider from ACE to SQL Server makes the problem go away - the process exits properly once the window is closed. In other words, this is most probably a problem with the ACE provider rather than System.Data.OleDB, and should be reproducible outside of .NET. SQL Server repro detailsCREATE TABLE MaterialTable (
ID int PRIMARY KEY,
material nvarchar(max)
);
INSERT INTO MaterialTable (ID, material) VALUES (1, 'Copper'); In the application, replace the connection string with the following: Dim connect_string As String = "Provider=sqloledb;Data Source=localhost;Initial Catalog=test;User Id=SA;Password=Abcd5678;" |
@roji Did you intend to do something here for 7.0? |
No, as far as I can tell at this point, this isn't an issue in System.Data.Odbc and there's nothing actionable on our side - though I can't be 100% sure. We can keep this open and move to Future, trying to bring this to the attention of the ACE OleDb driver maintainers. |
@roji Thank you for your response. I will investigate your suggestion of changing the OleDB provider from ACE to SQL. |
@ajos6183 rather than switching from ACE to SQL Server (which is quite a big type of change), I would recommend switching from OleDB to ADO.NET, which is the modern way to access databases in .NET. At that point you can use SQLite, which should be more similar to ACE than SQL Server (both being embeddable, single-file databases). |
In regards to #76712 , we are using ADO.NET with System.Data.OleDb provider. We can't exactly tell a client to 'use SQLite' when the issue arises from client importing data from Access databases into the application. The problem is not consistent across all machines that have the same .NET and same Office version; I agree it is likely an ACE or general office issue. The problem is consistent with .NET 5 and .NET 6; Framework 4.8 does not exhibit this behavior. Of course, 4.8 cannot see O365 dll's and require the Access runtime be separately installed. However, the problem also does occur in NET 5/6 when Access runtime is separately installed. The problem may arise in the ACE driver, but the NET application is stuck in endless loop of exception handling. |
I'll try to take another look at this soon; the information that this works on .NET Framework 4.8 may indicate an issue in .NET 6, since I'm assuming the same native ACE DLL OleDb driver is being used. |
Thanks guys, just an update that the issue seems to be resolved. A windows update may have taken care of the ACE issue. I suspect it is KB5002243 but i can't be sure. However, as @rutledget pointed out, the issue with the .NET5/6 exception handling may still exist and require attention. |
@ajos6183 thanks for the info! To be sure I understand, are you saying that after KB5002243, everything works well for you and there's no issue using ACE from .NET's System.Data.OleDb? In other words, do you suspect that there's a bug in .NET's System.Data.OleDb that only manifests when using a pre-KB5002243 ACE driver? |
@roji yes, I believe so. My testing from yesterday and today shows that all processes exit when I close the application. Whereas before, a process was left which used 100% of a CPU core. No changes were made to the application. |
Thank you! I'll try to take a look, though it may take a while before I'm able to do so. In the meantime it's good to know that installing KB5002243 can be a good workaround. |
Hi @roji , unfortunately, this is happening again. I can't explain why. There were a few security updates for Office 2016 and the .NET 6.0.10 update. |
Description
CPU intensive process left running after closing a WinForms .Net6 app that uses OleDB. I am not the first person to experience this. Please see following StackOverflow questions C# WinForm - EXE not terminating when closing main form & Reading access database, background process still running on close.
Reproduction Steps
Sample code attached WinFormsApp.zip. For the bug to be replicated, the exe must be opened outside of the visual studio environment.
Expected behavior
All processes would close on application exit.
Actual behavior
Process left running.
Regression?
This issue didn't happen in .Net framework as far I can tell but I didn't specifically test for it.
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: