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

Concurrent use of the same Query instance is not always threadsafe #125

Open
tzaeschke opened this issue May 4, 2020 · 0 comments · Fixed by #126
Open

Concurrent use of the same Query instance is not always threadsafe #125

tzaeschke opened this issue May 4, 2020 · 0 comments · Fixed by #126
Assignees
Labels
Milestone

Comments

@tzaeschke
Copy link
Owner

When multiple threads execute the same query using the same Query instance, a race condition can occur during initialization of query execution parameters.

No race condition occurs when the query does not use parameters.

As suggested by JDO, the query executor should use ThreadLocal query parameters to allow parallel query execution.

TODO:

  • Only do this for setMultiThreaded(true) ?
  • Provide default parameter set? At least give good error message if query is executed from a thread that did not set parameters (e.g. they were set in a different thread)
  • Include also "range" and other execution settings
  • Consider synchronizing the query compilation, while we are at it?
tzaeschke added a commit that referenced this issue May 9, 2020
tzaeschke added a commit that referenced this issue May 9, 2020
@tzaeschke tzaeschke added the bug label May 9, 2020
@tzaeschke tzaeschke self-assigned this May 9, 2020
@tzaeschke tzaeschke added this to the 0.6.1 milestone May 9, 2020
@tzaeschke tzaeschke linked a pull request May 9, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant