Skip to content

Instantly share code, notes, and snippets.

@shi-yan
Last active September 18, 2018 00:02
Show Gist options
  • Save shi-yan/dc97d0c89db1b791e03a96d81e9ac29f to your computer and use it in GitHub Desktop.
Save shi-yan/dc97d0c89db1b791e03a96d81e9ac29f to your computer and use it in GitHub Desktop.

Revisions

  1. shi-yan revised this gist Sep 18, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion node_odbc_ms_odbc_17.md
    Original file line number Diff line number Diff line change
    @@ -41,4 +41,6 @@

    SSL_library_init should be called instead for openssl <= 1.0.2

    downgrading node to 9.11.2 fixed the problem.
    downgrading node to 9.11.2 fixed the problem.

    https://www.abeautifulsite.net/how-to-upgrade-or-downgrade-nodejs-using-npm
  2. shi-yan revised this gist Sep 18, 2018. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions node_odbc_ms_odbc_17.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    ```{ [Error: [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]]
    ```
    { [Error: [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]]
    errors:
    [ { message:
    '[unixODBC][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]',
    @@ -9,14 +10,16 @@
    error: '[node-odbc] SQL_ERROR',
    message:
    '[unixODBC][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]',
    state: '08001' }```
    state: '08001' }
    ```


    The above is the original error message using node 10.10 + node-odbc + unixodbc + Microsoft's odbc driver 17.

    MS odbc 17 uses openssl 1.0.2, but node 10.10 initiaizes Openssl incorrectly. With gdb, you could see, node calls OPENSSL_init_ssl

    ```#0 0x000000000132b1d4 in ssl_load_ciphers ()
    ```
    #0 0x000000000132b1d4 in ssl_load_ciphers ()
    #1 0x000000000132eebe in ossl_init_ssl_base_ossl_ ()
    #2 0x00007ffff6e75827 in __pthread_once_slow (once_control=0x2489d58 <ssl_base>, init_routine=0x132ed00 <ossl_init_ssl_base_ossl_>) at pthread_once.c:116
    #3 0x00000000014613e9 in CRYPTO_THREAD_run_once ()
    @@ -31,6 +34,7 @@
    #11 0x0000000000b8936f in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) ()
    #12 0x0000000000b89ed9 in v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) ()
    ```

    according to

    https://wiki.openssl.org/index.php/Library_Initialization
  3. shi-yan created this gist Sep 18, 2018.
    40 changes: 40 additions & 0 deletions node_odbc_ms_odbc_17.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    ```{ [Error: [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]]
    errors:
    [ { message:
    '[unixODBC][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]',
    state: '08001' },
    { message:
    '[unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection',
    state: '08001' } ],
    error: '[node-odbc] SQL_ERROR',
    message:
    '[unixODBC][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]',
    state: '08001' }```
    The above is the original error message using node 10.10 + node-odbc + unixodbc + Microsoft's odbc driver 17.
    MS odbc 17 uses openssl 1.0.2, but node 10.10 initiaizes Openssl incorrectly. With gdb, you could see, node calls OPENSSL_init_ssl
    ```#0 0x000000000132b1d4 in ssl_load_ciphers ()
    #1 0x000000000132eebe in ossl_init_ssl_base_ossl_ ()
    #2 0x00007ffff6e75827 in __pthread_once_slow (once_control=0x2489d58 <ssl_base>, init_routine=0x132ed00 <ossl_init_ssl_base_ossl_>) at pthread_once.c:116
    #3 0x00000000014613e9 in CRYPTO_THREAD_run_once ()
    #4 0x000000000132ef9f in OPENSSL_init_ssl ()
    #5 0x00000000009f4fc0 in node::crypto::InitCryptoOnce() ()
    #6 0x00007ffff6e75827 in __pthread_once_slow (once_control=0x24789c0 <node::crypto::Initialize(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)::init_once>,
    init_routine=0x9f4fb0 <node::crypto::InitCryptoOnce()>) at pthread_once.c:116
    #7 0x00007ffff6e758e5 in __GI___pthread_once (once_control=<optimized out>, init_routine=<optimized out>) at pthread_once.c:143
    #8 0x0000000000a39e79 in uv_once (guard=<optimized out>, callback=<optimized out>) at ../deps/uv/src/unix/thread.c:363
    #9 0x00000000009fb7bc in node::crypto::Initialize(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*) ()
    #10 0x00000000008d45c3 in node::GetBinding(v8::FunctionCallbackInfo<v8::Value> const&) ()
    #11 0x0000000000b8936f in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) ()
    #12 0x0000000000b89ed9 in v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) ()
    ```
    according to

    https://wiki.openssl.org/index.php/Library_Initialization

    SSL_library_init should be called instead for openssl <= 1.0.2

    downgrading node to 9.11.2 fixed the problem.