-
Notifications
You must be signed in to change notification settings - Fork 1.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
[QUESTION] LiteDB 5 System.IO.IOException: The process cannot access the file because it is being used by another process #1656
Comments
@DanTwomey Could you try with the latest master? |
@lbnascimento This seems to have worked, don't seem to be getting the exceptions any more but will keep an eye out. Do you have an ETA on a NuGet release? |
@DanTwomey Next incremental release should be out soon, no ETA though. However, if you check the commits since the latest release, most of them are fixes for specific issues in the mapper. No internal changes to the engine were made (other than the fix for this issue, which was very simple). |
I seem to still be getting System IO Exceptions with the latest Master, If the WIndows Service is running and accessing the database first and then the WPF app launches and attempts to use the database I get a System IO Exception. If I launch the WPF app first, then start the service, I don't get any exceptions and I can continue to close and re-launch the WPF app with no issues. I had both of these exceptions from the WPF App whilst the service was started first:
Mutex exception I wasn't getting yesterday:
|
Some more info that could be useful: If I run the WPF App as Administrator (Right click -> Run As Administrator) there are no exceptions from the WPF App, without elevation, I get the exceptions straight away. |
@DanTwomey Could you test with the latest master? I made some changes, I believe it is working now. |
The changes seem to have fixed the issue with the Mutex being used by both applications, both are now able to read and write to the database, however we are now randomly getting this exception:
Once this exception happens in the service, the WPF app will infinitely wait on the first collection.FindOne() and never continue until the service has been restarted. Unfortunately we cannot yet find a way to force this issue to reproduce consistently to give any steps. |
@DanTwomey I made a commit that should fix the AbandonedMutexException problem, try it and see if it works for you. I'm going to close this issue, since the original issue was solved. If the problem persists if you have another problem, please open another issue. |
We currently have a client application which consists of a Windows Service and a WPF application, both utilising LiteDB and targeting .Net Framework 4.8.
The windows service runs under the local system account and the WPF app runs under the user's account.
We made the choice to upgrade from 4.1.4 to 5.0.7 in the hopes that concurrency was better supported.
Both WPF app and win service access the same LiteDB (read and write) with connection=shared using the below connection string:
"Filename=C:\temp\Test-v5.db;password=pass1234;connection=shared"
We seem to have come across a breaking issue however and can't seem to find anyone else having the same/similar issue or anything else that could fix it.
The service frequently polls the database to handle and process data that has been inserted by the WPF app with both read and write operations.
The WPF app also reads and writes to the database but on a more sporadic time frame based on user interaction.
Despite both applications accessing the database in the same way and both specifying connection=shared, we are getting exceptions from both as they appear to be clashing.
As a side note when testing this issue and trying to figure out what was going on, we found that we did not get any exceptions with two WPF apps reading and writing from the same database, however as soon as we swap one WPF app out for a Windows Service, we start getting exceptions.
Does anyone know how we can stop this happening?
The text was updated successfully, but these errors were encountered: