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

Queries are getting blocked while running using multithreading against default session pool #1024

Open
alkatrivedi opened this issue Oct 17, 2023 · 2 comments
Assignees
Labels
api: spanner Issues related to the googleapis/python-spanner API.

Comments

@alkatrivedi
Copy link

alkatrivedi commented Oct 17, 2023

While running database queries using multiple threads, execution is getting blocked.
Reason: When a transaction is initialised, in case of Bursty Session Pool a new session will get created. While creating a session spanner_api method will get called to get the object reference to the spanner api. When there will be parallel execution of the queries using multiple threads, all the threads will try to create the spanner api object at the same time which is causing thread race in our program. This is why our execution is not Thread Safe and is getting blocked.

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner API. label Oct 17, 2023
@alkatrivedi
Copy link
Author

Code snippet(which is getting blocked while executing)
multithreading.py.zip

@surbhigarg92
Copy link
Contributor

@harshachinta Can you please triage this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API.
Projects
None yet
Development

No branches or pull requests

3 participants