Closed abmusse closed 5 years ago
Using v2.0 beta using node 8.12.0
I ran into a bug while testing out the connection class.
With the following code:
const { Connection } = require('odbc'); const connectionString = `DRIVER=${process.env.DRIVER};SYSTEM=${process.env.HOST};UID=${process.env.DBUSER};PWD=${process.env.DBPASS};`; const connection = new Connection(connectionString);
If any of the of the connection details within the connection string are invalid the program exits abnormally and a core file is dumped.
FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw 1: node::Abort() [/usr/bin/node] 2: 0x55e84ab77182 [/usr/bin/node] 3: 0x55e84ab7a9ad [/usr/bin/node] 4: napi_fatal_error [/usr/bin/node] 5: 0x7f3489c33236 [.../node_modules/odbc/build/Release/odbc.node] 6: Napi::CallbackInfo::CallbackInfo(napi_env__*, napi_callback_info__*) [../node_modules/odbc/build/Release/odbc.node] 7: ODBC::ConnectSync(Napi::CallbackInfo const&) [.../node_modules/odbc/build/Release/odbc.node] 8: Napi::details::CallbackData<Napi::Value (*)(Napi::CallbackInfo const&), Napi::Value>::Wrapper(napi_env__*, napi_callback_info__*) [../node_modules/odbc/build/Release/odbc.node] 9: 0x55e84ab82838 [/usr/bin/node] 10: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/bin/node] 11: 0x55e84ad9a7bc [/usr/bin/node] 12: 0x55e84ad9ae87 [/usr/bin/node] 13: 0xbd624a842fd Aborted (core dumped)
I traced the problem down to the ODBC::ConnectSync method.
When the connection details are incorrect the call to SQLDriverConnect will fail.
There is a check to see if the call succeed but it fails to return out of the method when errors occur.
The same issue of not bailing out occurs throughout ODBC::ConnectSync.
ODBC::ConnectSync
Fixed with PR #62
Using v2.0 beta using node 8.12.0
I ran into a bug while testing out the connection class.
With the following code:
If any of the of the connection details within the connection string are invalid the program exits abnormally and a core file is dumped.
I traced the problem down to the ODBC::ConnectSync method.
When the connection details are incorrect the call to SQLDriverConnect will fail.
There is a check to see if the call succeed but it fails to return out of the method when errors occur.
The same issue of not bailing out occurs throughout
ODBC::ConnectSync
.