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

SQLiteStorageEngine can return stale data in rare cases #753

Closed
borrrden opened this issue Sep 30, 2016 · 0 comments
Closed

SQLiteStorageEngine can return stale data in rare cases #753

borrrden opened this issue Sep 30, 2016 · 0 comments
Milestone

Comments

@borrrden
Copy link
Member

borrrden commented Sep 30, 2016

Reproduction steps:

This scenario requires three thread to all fall into a certain sequence:

  1. Thread A starts a query that takes a long time (implicitly begins read transaction on read connection)
  2. Thread B inserts a document (using write connection)
  3. Thread C retrieves the documents (using read connection)
  4. Thread A finishes

Step 3 will show the document as missing, despite it existing. This is because Thread A has locked the read connection on a stale state with its implicit transaction. There are two ways to fix this:

  1. Serialize queries as well as writes
  2. Let each thread have a separate read connection to the database

Option 2 would be more in line with what iOS does

@borrrden borrrden added this to the 1.3.2 milestone Sep 30, 2016
@borrrden borrrden added the bug label Sep 30, 2016
borrrden added a commit that referenced this issue Oct 11, 2016
@borrrden borrrden modified the milestones: 1.4.0, 1.3.2 Nov 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants