Skip to content
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

Code Quality: Downgrade LiteDB to fix transaction issue #15217

Merged
merged 3 commits into from
Apr 17, 2024

Conversation

hez2010
Copy link
Member

@hez2010 hez2010 commented Apr 17, 2024

Resolved / Related Issues
We hit litedb-org/LiteDB#2435 which results in Files crashing. As a workaround, we may use Shared connection instead of Direct. It may slow down the query speed, but it no longer crashes.
Closes #15203
Closes #15172
Closes #15157

Validation
How did you test these changes?

  • Did you build the app and test your changes?

Screenshots (optional)
Add screenshots here.

@yaira2
Copy link
Member

yaira2 commented Apr 17, 2024

It may slow down the query speed, but it no longer crashes.

Do you have any idea how much of a difference it makes?

@hez2010
Copy link
Member Author

hez2010 commented Apr 17, 2024

Do you have any idea how much of a difference it makes?

In my simple test 100 times of insertion and query (200 ops in total) regressed from 0.01 seconds to 0.2 seconds (20x slower).

@hez2010
Copy link
Member Author

hez2010 commented Apr 17, 2024

Maybe we can instead downgrade to LiteDB v5.0.17 so that we don't have to suffer from the performance regression?
Or we can maintain a fork of LiteDB by ourselves until the bug get fixed in upstream.
Or maybe we can change our database provider to something else such as FASTER.

@hez2010
Copy link
Member Author

hez2010 commented Apr 17, 2024

While I'm hitting another issue in LiteDB after switching to Shared connection:

System.Threading.SynchronizationLockException: 'The lock is being disposed while still being used. It either is being held by a thread and/or has active waiters waiting to acquire the lock.'

Seems that switching to Shared connection is not a correct fix.
We should consider either forking or downgrading LiteDB or changing database provider.

@yaira2
Copy link
Member

yaira2 commented Apr 17, 2024

Sounds like downgrading is the best option for now

@hez2010
Copy link
Member Author

hez2010 commented Apr 17, 2024

There's still a rare possibility getting crash due to System.ExecutionEngineException caused by LiteDB if you quickly switch between folders hundreds or thousands of times, but generally it should work now. (not sure why it happens as such exception doesn't have a stacktrace).

@yaira2 yaira2 changed the title Fix: Address crashing due to LiteDB transaction issue Code Quality: Downgrade LiteDB to fix transaction issue Apr 17, 2024
@yaira2 yaira2 merged commit 0947237 into files-community:main Apr 17, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants