-
Notifications
You must be signed in to change notification settings - Fork 564
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
Observed Behavior: pyodbc.drivers() not thread safe #715
Comments
It is likely mod_datasources() suffers the same behavior. |
|
I can reproduce and will look into it |
I made a PR that should fix it: I ran your repro and after several million iterations there were no mismatches |
mkleehammer
pushed a commit
that referenced
this issue
Jan 22, 2021
* Merging updates. (#1) Merging updates. * fix for smalldatetime issue * Fixed a bad merge * Fix for inserting high unicode chars * merge with main branch * Fix for function sequence error * reverted unnecessary file changes * removed obsolete include * fix for 540 * fix for TVP type mismatch issue * Combined the IFs * Fix for threading issues when using SQLDrivers and SQLDataSources Co-authored-by: v-chojas <25211973+v-chojas@users.noreply.github.com> Co-authored-by: v-chojas <v-chojas@microsoft.com>
Fixed by #722. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pyodb.drivers() method can return an incomplete list of drivers if multiple threads call this method at the same time.
Based on the ODBC SQLDrivers method API, the c++ code must iterate through a list of drivers, specifying the start or the next available driver. If two threads have entered the for loop of mod_drivers() in pyodbcmodule.cpp one or both of the threads may miss a driver that the other thread has incremented through.
The text was updated successfully, but these errors were encountered: