Uploaded image for project: 'C++ Couchbase Client'
  1. C++ Couchbase Client
  2. CXXCBC-455

Crash when trying to detect query port if alternateAdresses misconfigured

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • 1.0.0
    • None
    • None

    Description

      The library might be confused when configuration has duplicated ports that ambiguously identify service location due to misconfiguration of alternative addresses. It could be possible because SG would send it some broken configuration. The SDK must be more defensive when taking configurations.

      [2024-02-09 23:58:44.726] [95243,96227] [debug] 12ms, [25785b-91c2-3d4b-7559-47e6fae2f3c6a5/41cec3-5a8c-654e-c199-9fb3e1ef537cde] <172.31.40.12:18104> put HTTP session back to idle connections
      [2024-02-09 23:58:44.726] [95243,95243] [debug] 0ms, QUERY: client_context_id="46e7f3-7591-b648-3116-1474e8828a51e7", prep=false, "select * from default limit 100;", options={"client_context_id":"46e7f3-7591-b648-3116-1474e8828a51e7","metrics":false,"timeout":"74500ms"}
      [2024-02-09 23:58:44.731] [95243,96227] [debug] 4ms, [25785b-91c2-3d4b-7559-47e6fae2f3c6a5/74fcaa-9f4e-8d40-511e-2da8c1ab11c66b] <172.31.40.12:18104> put HTTP session back to idle connections
      [2024-02-09 23:58:44.731] [95243,95243] [debug] 0ms, QUERY: client_context_id="a3d322-f949-0846-e835-53ea8bc1df3a48", prep=false, "select * from default limit 100;", options={"client_context_id":"a3d322-f949-0846-e835-53ea8bc1df3a48","metrics":false,"timeout":"74500ms"}
      [2024-02-09 23:58:44.737] [95243,96227] [debug] 5ms, [25785b-91c2-3d4b-7559-47e6fae2f3c6a5/bbb105-3e10-db41-1463-60463d6fd0ede7] <172.31.40.12:18105> put HTTP session back to idle connections
      [2024-02-09 23:58:44.737] [95243,95243] [debug] 0ms, QUERY: client_context_id="73cbd0-282f-aa41-b298-5fbd1e7ce6a50b", prep=false, "select * from default limit 100;", options={"client_context_id":"73cbd0-282f-aa41-b298-5fbd1e7ce6a50b","metrics":false,"timeout":"74500ms"}
      [2024-02-09 23:58:44.751] [95243,96227] [debug] 14ms, [25785b-91c2-3d4b-7559-47e6fae2f3c6a5/41cec3-5a8c-654e-c199-9fb3e1ef537cde] <172.31.40.12:18104> put HTTP session back to idle connections
       
        #  node[95243]: void node::ResetStdio() at ../src/node.cc:711
        #  Assertion failed: !(err != 0) || (err == -1 && (*__errno_location ()) == 1)
       
      ----- Native stack trace -----
       
       1: 0xdf4a07 node::Assert(node::AssertionInfo const&) [node]
       2: 0xda7664  [node]
       3: 0xda7c7d node::TrapWebAssemblyOrContinue(int, siginfo_t*, void*) [node]
       4: 0x7f49dd842520  [/lib/x86_64-linux-gnu/libc.so.6]
       5: 0x7f49b600ede8 std::_Rb_tree<std::string, std::pair<std::string const, couchbase::core::topology::configuration::alternate_address>, std::_Select1st<std::pair<std::string const, couchbase::core::topology::configuration::alternate_address> >, std::less<std::string>, std::allocator<std::pair<std::string const, couchbase::core::topology::configuration::alternate_address> > >::find(std::string const&) const [/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.2.9-napi-v6-linux-x64-boringssl.node]
       6: 0x7f49b600ded2 couchbase::core::topology::configuration::node::port_or(std::string const&, couchbase::core::service_type, bool, unsigned short) const [/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.2.9-napi-v6-linux-x64-boringssl.node]
       7: 0x7f49b5dc8dd0 couchbase::core::io::http_session_manager::check_out(couchbase::core::service_type, couchbase::core::cluster_credentials const&, std::string const&) [/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.2.9-napi-v6-linux-x64-boringssl.node]
       8: 0x7f49b5eca288 void couchbase::core::io::http_session_manager::execute<couchbase::core::operations::query_request, couchbase::core::utils::movable_function<void (couchbase::core::operations::query_response)> >(couchbase::core::operations::query_request, couchbase::core::utils::movable_function<void (couchbase::core::operations::query_response)>&&, couchbase::core::cluster_credentials const&) [/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.2.9-napi-v6-linux-x64-boringssl.node]
       9: 0x7f49b5c540c3 couchbase::core::cluster::execute(couchbase::core::operations::query_request, couchbase::core::utils::movable_function<void (couchbase::core::operations::query_response)>&&) const [/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.2.9-napi-v6-linux-x64-boringssl.node]
      10: 0x7f49b5b8b406 couchnode::Connection::jsQuery(Napi::CallbackInfo const&) [/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.2.9-napi-v6-linux-x64-boringssl.node]
      11: 0x7f49b5b5ef44 napi_value__* Napi::details::TemplatedInstanceCallback<couchnode::Connection, &couchnode::Connection::jsQuery>(napi_env__*, napi_callback_info__*) [/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.2.9-napi-v6-linux-x64-boringssl.node]
      12: 0xd8dfb9  [node]
      13: 0x7f49d65ceadd 
       
      ----- JavaScript stack trace -----
       
      1: /opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/couchbase/dist/queryexecutor.js:90:32
      2: execute (/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/couchbase/dist/queryexecutor.js:27:9)
      3: query (/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/couchbase/dist/queryexecutor.js:89:30)
      4: /opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/couchbase/dist/cluster.js:279:63
      5: wrapAsync (/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/couchbase/dist/utilities.js:47:16)
      6: query (/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/node_modules/couchbase/dist/cluster.js:279:42)
      7: /opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/src/build/Commands/QueryOperationRunner.js:220:49
      8: step (/opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/src/build/Commands/QueryOperationRunner.js:33:23)
      9: /opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/src/build/Commands/QueryOperationRunner.js:14:53
      10: /opt/actions-runner/_work/fit-app-deployment/fit-app-deployment/transactions-fit-performer/performers/node/src/build/Commands/QueryOperationRunner.js:8:71
       
       
      Aborted (core dumped)
       
        #  Node.js[95227]: void node::ResetStdio() at ../src/node.cc:711
        #  Assertion failed: !(err != 0) || (err == -1 && (*__errno_location ()) == 1)
       
      ----- Native stack trace -----
       
       1: 0xdf4a07 node::Assert(node::AssertionInfo const&) [npm run start]
       2: 0xda7664  [npm run start]
       3: 0x7f9fe2c45495  [/lib/x86_64-linux-gnu/libc.so.6]
       4: 0x7f9fe2c45610 on_exit [/lib/x86_64-linux-gnu/libc.so.6]
       5: 0xd0b06c node::DefaultProcessExitHandlerInternal(node::Environment*, node::ExitCode) [npm run start]
       6: 0xd6a7df node::Environment::Exit(node::ExitCode) [npm run start]
       7: 0x7f9fdbe0eadd 
       
        #  Node.js[95227]: void node::ResetStdio() at ../src/node.cc:711
        #  Assertion failed: !(err != 0) || (err == -1 && (*__errno_location ()) == 1)
       
      ----- Native stack trace -----
       
       1: 0xdf4a07 node::Assert(node::AssertionInfo const&) [npm run start]
       2: 0xda7664  [npm run start]
       3: 0xda7c7d node::TrapWebAssemblyOrContinue(int, siginfo_t*, void*) [npm run start]
       4: 0x7f9fe2c42520  [/lib/x86_64-linux-gnu/libc.so.6]
       5: 0x16dffa0 v8::internal::tracing::TraceEventHelper::GetTracingController() [npm run start]
       6: 0x11cf075 v8::internal::Isolate::CaptureDetailedStackTrace(int, v8::StackTrace::StackTraceOptions) [npm run start]
       7: 0x105c313 v8::StackTrace::CurrentStackTrace(v8::Isolate*, int, v8::StackTrace::StackTraceOptions) [npm run start]
       8: 0xdf4966 node::GetCurrentStackTrace(v8::Isolate*, int) [npm run start]
       9: 0xd4d06b node::DumpJavaScriptBacktrace(_IO_FILE*) [npm run start]
      10: 0xdf4a13 node::Assert(node::AssertionInfo const&) [npm run start]
      11: 0xda7664  [npm run start]
      12: 0x7f9fe2c45495  [/lib/x86_64-linux-gnu/libc.so.6]
      13: 0x7f9fe2c45610 on_exit [/lib/x86_64-linux-gnu/libc.so.6]
      14: 0xd0b06c node::DefaultProcessExitHandlerInternal(node::Environment*, node::ExitCode) [npm run start]
      15: 0xd6a7df node::Environment::Exit(node::ExitCode) [npm run start]
      16: 0x7f9fdbe0eadd 
      

      Possible way to reproduce is to setup alternative addresses and duplicate service ports for different nodes.

      Useful commands:

      kubectl get namespaces -A
      kubectl get pods -A
      kubectl logs couchbase-operator-admission-5fb99dd68d-5rhwn  -n cbdc2-cao-admission
      kubectl get services -A
      curl http://192.168.107.2:31732
      kubectl get couchbaseclusters -A
      kubectl patch couchbaseclusters cluster --type merge --patch '{"spec":{"paused": true}}' -n cbdc2-00d7e371a6664db08b2f76279635eea4 
      

      curl -v -X PUT -u Administrator:password \
      http://192.168.107.2:30617/node/controller/setupAlternateAddresses/external \
      -d hostname=192.168.107.2 \
      -d kv=31996  # meant to be 30995
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              avsej Sergey Avseyev
              avsej Sergey Avseyev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes