-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
unixodbc
not unloading dynamic libraries when calling SQLDisconnect
#643
Comments
I've forgot to mention that I've deactivated pooling both from library (default) and [ODBC]
Pooling=No this is to ensure unixODBC does not keep the library loaded to make pooling faster |
Hello @amountainram , I am not sure under which, if any, circumstances unixODBC would unload a driver. Closing all the connections associated with that driver would certainly be a precondition. Seems to be some options around it, but I can not find any documentation outside of C headers. Best hint I got so far is here: https://github.com/lurcher/unixODBC/blob/93b0d9d5e7ecd5e1f62af05c3872c2173696ab27/DriverManager/SQLConnect.c#L1058 Ultimately it is up to the driver manager to load and maybe unload any symbols from dynamically linked memory.
That's a recommendation for a typical application. A typical application would also reuse the same driver over and over again with maybe even more than one connection in parallel. Your use-case seems different. Feel free to deviate from the recommendation. I would probably stick to ODBC environment at once and not roll the dice to hard, on how the drivers are implemented in C and how they use global state. If it comes down to it, I can not answer your question whether unixODBC should free this memory and call dlclose. There seem to be some relevant options though in the mapping string. Best, Markus |
Hi,
I've an application which acts as job runner: it schedules and executes task which in turn use
odbc-api
to connect to a SQL DB via the respective driver.The connect/fetch/disconnect parts of my routines successfully run. For the sake of example this may be a job:
The odbc env is an
odbc_api::Environment
which is shared across the whole application as a singleton as suggested in the documentation.Since my application runs different jobs and most of time may stay idle i'd like the dynamically loaded drivers to unload when all connections to that driver are disconnected and their handles dropped.
I've had a look to unixODBC source code and somehow here and thus here the driver should/could be unloaded from memory.
The snippet above ofc triggers loading of the driver but disconnecting and then dropping the
conn
handle does not do anything and drivers stay in resident memory.Not even sure this a bug or an unhandled use case of this library, but I'm wondering whether I'm using incorrectly the handles or am I misunderstanding the underlying unixODBC library.
Thanks in advance for any comment on this issue
The text was updated successfully, but these errors were encountered: