Comments (6)
Looks like it's totally unsafe to allocate multiple environments. See https://odbcrouter.com/api/index.shtml?SQLAllocEnv for example.
On operating systems that support multiple threads, applications can use the same henv on different threads and drivers must therefore support safe, multithreaded access to this information. The application passes the henv value in all subsequent calls that require an henv.
There should never be more than one henv allocated at one time and the application should not call SQLAllocEnv when there is a current valid henv. If the application calls SQLAllocEnv with a pointer to a valid henv, the driver overwrites the henv without regard to its previous contents. (ODBCSDK/OverDRIVER returns the same handle.)
from odbc-rs.
Seems to be true. The race conditions in the tests seem to indicate the same :-(. Despite having to prevent the user from instantiating the wrapper class more than once, this raises another troubling issue: Our library probably would not compose safely with other ODBC wrappers. I stated the issue with a call for help in this reddit thread. Maybe you want to weigh in.
from odbc-rs.
@pacman82 I think situation when someone uses two ODBC wrappers simultaneously in the same process is pretty exotic and probably the man who does this knows well what he's doing. It's good enough to prevent multiple instantiation of rust odbc environment wrapper and trust end user to not screw things up with another wrapper. And we need to ensure that our environment wrapper can be shared between threads comfortably - as it's allowed by odbc contract and user will have no ability to instantiate second environment.
from odbc-rs.
And may be we should allow unsafe construction of our wrapper from raw environment handle which can be allocated by another wrapper for example to give end user ability to use our wrapper with externally constructed environment?
from odbc-rs.
Yesterday I discovered a bug I introduced in my fork (shame on me). Since fixing it I do no longer experience any data races while running tests. Reading the ODBC reference I did still not find any indication that allocating more than one Environment is UB. Yet we both did find secondary documentation claiming otherwise. In would suggest "in dubio pro reo": Our growing number of tests should eventually show if multiple Environments are a problem. Especially since they run in parallel. Until the tests show this to be the case I'm willing to assume multiple Environments are safe.
If you agree I would regard this issue as closed.
from odbc-rs.
Ok, let's leave to end user as original API do.
from odbc-rs.
Related Issues (20)
- No reexport for odbc_safe HOT 2
- parameter binding problem(Is this dangling pointer?) HOT 4
- Code in Readme: wrong number of type arguments: expected 1, found 0 HOT 4
- Send+Sync for connection HOT 4
- odbc v0.13.0 does not compile any more HOT 3
- How can I connect to MS DataBase HOT 8
- Panic when Reading table from DB2 Driver HOT 6
- Incorrect affected_row_count using UPDATE and SELECT clause from SQL Server
- Invalid handle panic due to connection dropped before statement HOT 1
- Is it possible to get SQL_INTERVAL_STRUCT from a cursor?
- access office access?
- Arrow output HOT 5
- Connection Pooling support HOT 10
- async/.await HOT 1
- New Beginner: top level return for values example. HOT 1
- FromBytesWithNulError { kind: InteriorNul(1) }
- Travis out of credits
- lib build failed HOT 2
- This repo is unsupported HOT 1
- Unsound implementation of `convert_primitive` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from odbc-rs.