Skip to content

Conversation

ptiurin
Copy link
Contributor

@ptiurin ptiurin commented Nov 21, 2022

As a recent issue showed, sharing a cursor in a multi-threaded environment is not safe. The issue stems from asyncio not playing nicely in such environment. Moreover, this also leads to a confusion on query result retention - if several queries run at the same time it's not deterministic which query's result will be stored (also its success status). Therefore the best practice is not to share cursors at all.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@ptiurin ptiurin merged commit 2b9dcd1 into main Nov 21, 2022
@ptiurin ptiurin deleted the docs-thread-safety branch November 21, 2022 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants