Community edition 7.2.4 & Node.js SDK 4.4.6 free(): invalid pointer

Hello,

We are currently facing a problem which occurs while navigating on our website, we haven’t identified any route / N1QL request that might be causing this issue, it seems to happen randomly after navigating.

When i go to the server logs i get this one before the crash : free(): invalid pointer

I ran valgrind to check where this was coming from and saw some paths leading to couchbase, here’s the log (i cut part of the log because of the characters limit) :

Thread 12:
Invalid read of size 8
   at 0x7106F6C: memmove (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x7221573: std::string::_M_mutate(unsigned long, unsigned long, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x72216D6: std::string::_M_leak_hard() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x2E9AC783: bool std::__detail::_Compiler<std::regex_traits<char> >::_M_expression_term<false, false>(std::pair<bool, char>&, std::__detail::_BracketMatcher<std::regex_traits<char>, false, false>&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B2AFD: void std::__detail::_Compiler<std::regex_traits<char> >::_M_insert_bracket_matcher<false, false>(bool) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B3EC3: std::__detail::_Compiler<std::regex_traits<char> >::_M_bracket_expression() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B3F8F: std::__detail::_Compiler<std::regex_traits<char> >::_M_atom() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B478F: std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B4702: std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B49A8: std::__detail::_Compiler<std::regex_traits<char> >::_M_disjunction() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B50B4: std::__detail::_Compiler<std::regex_traits<char> >::_Compiler(char const*, char const*, std::locale const&, std::regex_constants::syntax_option_type) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9D55CA: couchbase::core::operations::query_request::make_response(couchbase::core::error_context::query&&, couchbase::core::io::http_response const&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
 Address 0x36083038 is 8 bytes before a block of size 121,203,257 alloc'd
   at 0x70FAFA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x7221148: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x72214BA: std::string::_M_mutate(unsigned long, unsigned long, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x72216D6: std::string::_M_leak_hard() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x2E9AC783: bool std::__detail::_Compiler<std::regex_traits<char> >::_M_expression_term<false, false>(std::pair<bool, char>&, std::__detail::_BracketMatcher<std::regex_traits<char>, false, false>&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B2AFD: void std::__detail::_Compiler<std::regex_traits<char> >::_M_insert_bracket_matcher<false, false>(bool) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B3EC3: std::__detail::_Compiler<std::regex_traits<char> >::_M_bracket_expression() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B3F8F: std::__detail::_Compiler<std::regex_traits<char> >::_M_atom() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B478F: std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B4702: std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B49A8: std::__detail::_Compiler<std::regex_traits<char> >::_M_disjunction() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B50B4: std::__detail::_Compiler<std::regex_traits<char> >::_Compiler(char const*, char const*, std::locale const&, std::regex_constants::syntax_option_type) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)

...

Invalid read of size 8
   at 0x7106F88: memmove (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x7221573: std::string::_M_mutate(unsigned long, unsigned long, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x72216D6: std::string::_M_leak_hard() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x2E9AC783: bool std::__detail::_Compiler<std::regex_traits<char> >::_M_expression_term<false, false>(std::pair<bool, char>&, std::__detail::_BracketMatcher<std::regex_traits<char>, false, false>&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B2AFD: void std::__detail::_Compiler<std::regex_traits<char> >::_M_insert_bracket_matcher<false, false>(bool) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B3EC3: std::__detail::_Compiler<std::regex_traits<char> >::_M_bracket_expression() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B3F8F: std::__detail::_Compiler<std::regex_traits<char> >::_M_atom() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B478F: std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B4702: std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B49A8: std::__detail::_Compiler<std::regex_traits<char> >::_M_disjunction() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B50B4: std::__detail::_Compiler<std::regex_traits<char> >::_Compiler(char const*, char const*, std::locale const&, std::regex_constants::syntax_option_type) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9D55CA: couchbase::core::operations::query_request::make_response(couchbase::core::error_context::query&&, couchbase::core::io::http_response const&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
 Address 0x36083020 is 32 bytes before a block of size 121,204,640 in arena "client"


Process terminating with default action of signal 11 (SIGSEGV): dumping core
   at 0x7555B2C: __pthread_kill_implementation (pthread_kill.c:44)
   by 0x7555B2C: __pthread_kill_internal (pthread_kill.c:78)
   by 0x7555B2C: pthread_kill@@GLIBC_2.34 (pthread_kill.c:89)
   by 0x74FC27D: raise (raise.c:26)
   by 0xF14531: node::TrapWebAssemblyOrContinue(int, siginfo_t*, void*) (in /usr/bin/node)
   by 0x74FC32F: ??? (in /usr/lib/x86_64-linux-gnu/libc.so.6)
   by 0x7106F6B: memmove (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x7221573: std::string::_M_mutate(unsigned long, unsigned long, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x72216D6: std::string::_M_leak_hard() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x2E9AC783: bool std::__detail::_Compiler<std::regex_traits<char> >::_M_expression_term<false, false>(std::pair<bool, char>&, std::__detail::_BracketMatcher<std::regex_traits<char>, false, false>&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B2AFD: void std::__detail::_Compiler<std::regex_traits<char> >::_M_insert_bracket_matcher<false, false>(bool) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B3EC3: std::__detail::_Compiler<std::regex_traits<char> >::_M_bracket_expression() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B3F8F: std::__detail::_Compiler<std::regex_traits<char> >::_M_atom() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E9B478F: std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)

HEAP SUMMARY:
    in use at exit: 133,635,367 bytes in 38,028 blocks
  total heap usage: 4,447,087 allocs, 4,409,059 frees, 1,370,812,977 bytes allocated

Thread 1:
320 bytes in 1 blocks are possibly lost in loss record 5,100 of 5,764
   at 0x7101953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x68C85AB: calloc (rtld-malloc.h:44)
   by 0x68C85AB: allocate_dtv (dl-tls.c:370)
   by 0x68C85AB: _dl_allocate_tls (dl-tls.c:629)
   by 0x7554616: allocate_stack (allocatestack.c:429)
   by 0x7554616: pthread_create@@GLIBC_2.34 (pthread_create.c:655)
   by 0x1CD190B: uv_thread_create_ex (thread.c:172)
   by 0x1CD190B: uv_thread_create (thread.c:126)
   by 0xFF9DFB: node::WorkerThreadsTaskRunner::WorkerThreadsTaskRunner(int, node::PlatformDebugLogLevel) (in /usr/bin/node)
   by 0xFFA10F: node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) (in /usr/bin/node)
   by 0xF1A8CD: node::InitializeOncePerProcessInternal(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, node::ProcessInitializationFlags::Flags) (in /usr/bin/node)
   by 0xF1BD8B: node::Start(int, char**) (in /usr/bin/node)
   by 0x74E11C9: (below main) (libc_start_call_main.h:58)

320 bytes in 1 blocks are possibly lost in loss record 5,101 of 5,764
   at 0x7101953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x68C85AB: calloc (rtld-malloc.h:44)
   by 0x68C85AB: allocate_dtv (dl-tls.c:370)
   by 0x68C85AB: _dl_allocate_tls (dl-tls.c:629)
   by 0x7554616: allocate_stack (allocatestack.c:429)
   by 0x7554616: pthread_create@@GLIBC_2.34 (pthread_create.c:655)
   by 0x1102C80: node::inspector::Agent::Start(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, node::DebugOptions const&, std::shared_ptr<node::ExclusiveAccess<node::HostPort, node::MutexBase<node::LibuvMutexTraits> > >, bool) (in /usr/bin/node)
   by 0xF165C4: node::Environment::InitializeInspector(std::unique_ptr<node::inspector::ParentInspectorHandle, std::default_delete<node::inspector::ParentInspectorHandle> >) (in /usr/bin/node)
   by 0xE6585B: node::CreateEnvironment(node::IsolateData*, v8::Local<v8::Context>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, node::EnvironmentFlags::Flags, node::ThreadId, std::unique_ptr<node::InspectorParentHandle, std::default_delete<node::InspectorParentHandle> >) (in /usr/bin/node)
   by 0xFC05FD: node::NodeMainInstance::CreateMainEnvironment(node::ExitCode*) (in /usr/bin/node)
   by 0xFC082E: node::NodeMainInstance::Run() (in /usr/bin/node)
   by 0xF1C04A: node::Start(int, char**) (in /usr/bin/node)
   by 0x74E11C9: (below main) (libc_start_call_main.h:58)

336 bytes in 1 blocks are possibly lost in loss record 5,119 of 5,764
   at 0x7101953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x68C85AB: calloc (rtld-malloc.h:44)
   by 0x68C85AB: allocate_dtv (dl-tls.c:370)
   by 0x68C85AB: _dl_allocate_tls (dl-tls.c:629)
   by 0x7554616: allocate_stack (allocatestack.c:429)
   by 0x7554616: pthread_create@@GLIBC_2.34 (pthread_create.c:655)
   by 0x7207EB0: std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x2E612562: couchnode::Instance::Instance() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E547C20: couchnode::Connection::Connection(Napi::CallbackInfo const&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E558747: Napi::ObjectWrap<couchnode::Connection>::ConstructorCallbackWrapper(napi_env__*, napi_callback_info__*) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0xEF79C4: v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) (in /usr/bin/node)
   by 0x122A349: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long*, int) (in /usr/bin/node)
   by 0x122A699: v8::internal::Builtin_HandleApiConstruct(int, unsigned long*, v8::internal::Isolate*) (in /usr/bin/node)
   by 0x1D883B5: Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit (in /usr/bin/node)
   by 0x1CEA3BB: Builtins_InterpreterPushArgsThenFastConstructFunction (in /usr/bin/node)

336 bytes in 1 blocks are possibly lost in loss record 5,120 of 5,764
   at 0x7101953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x68C85AB: calloc (rtld-malloc.h:44)
   by 0x68C85AB: allocate_dtv (dl-tls.c:370)
   by 0x68C85AB: _dl_allocate_tls (dl-tls.c:629)
   by 0x7554616: allocate_stack (allocatestack.c:429)
   by 0x7554616: pthread_create@@GLIBC_2.34 (pthread_create.c:655)
   by 0x2E966707: void asio::detail::resolver_service<asio::ip::tcp>::async_resolve<couchbase::core::io::mcbp_session_impl::initiate_bootstrap()::{lambda(auto:1&&, auto:2&&)#3}, asio::any_io_executor>(std::shared_ptr<void>&, asio::ip::basic_resolver_query<asio::ip::tcp> const&, couchbase::core::io::mcbp_session_impl::initiate_bootstrap()::{lambda(auto:1&&, auto:2&&)#3}&, asio::any_io_executor const&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E96D1F4: couchbase::core::io::mcbp_session_impl::initiate_bootstrap() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E955028: couchbase::core::io::mcbp_session::bootstrap(couchbase::core::utils::movable_function<void (std::error_code, couchbase::core::topology::configuration)>&&, bool) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E7C7F45: couchbase::core::cluster_impl::do_open(couchbase::core::utils::movable_function<void (std::error_code)>) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E7C9BC4: couchbase::core::cluster_impl::open(couchbase::core::origin, couchbase::core::utils::movable_function<void (std::error_code)>&&)::{lambda()#1}::operator()()::{lambda(std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > >, std::error_code)#1}::operator()(std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > >, std::error_code) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E7C9F77: std::_Function_handler<void (std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > >, std::error_code), couchbase::core::utils::movable_function<void (std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > >, std::error_code)>::wrapper<couchbase::core::cluster_impl::open(couchbase::core::origin, couchbase::core::utils::movable_function<void (std::error_code)>&&)::{lambda()#1}::operator()()::{lambda(std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > >, std::error_code)#1}, void> >::_M_invoke(std::_Any_data const&, std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > >&&, std::error_code&&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E91D2F0: ??? (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E93BF60: couchbase::core::io::dns::dns_srv_command::execute(std::chrono::duration<long, std::ratio<1l, 1000l> >, std::chrono::duration<long, std::ratio<1l, 1000l> >)::{lambda(std::error_code, unsigned long)#1}::operator()(std::error_code, unsigned long)::{lambda(std::error_code, unsigned long)#1}::operator()(std::error_code, unsigned long) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E93CEB5: asio::detail::reactive_socket_recvfrom_op<asio::mutable_buffers_1, asio::ip::basic_endpoint<asio::ip::udp>, couchbase::core::io::dns::dns_srv_command::execute(std::chrono::duration<long, std::ratio<1l, 1000l> >, std::chrono::duration<long, std::ratio<1l, 1000l> >)::{lambda(std::error_code, unsigned long)#1}::operator()(std::error_code, unsigned long)::{lambda(std::error_code, unsigned long)#1}, asio::any_io_executor>::do_complete(void*, asio::detail::scheduler_operation*, std::error_code const&, unsigned long) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)

1,280 bytes in 4 blocks are possibly lost in loss record 5,455 of 5,764
   at 0x7101953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x68C85AB: calloc (rtld-malloc.h:44)
   by 0x68C85AB: allocate_dtv (dl-tls.c:370)
   by 0x68C85AB: _dl_allocate_tls (dl-tls.c:629)
   by 0x7554616: allocate_stack (allocatestack.c:429)
   by 0x7554616: pthread_create@@GLIBC_2.34 (pthread_create.c:655)
   by 0x1CD190B: uv_thread_create_ex (thread.c:172)
   by 0x1CD190B: uv_thread_create (thread.c:126)
   by 0xFF9EDB: node::WorkerThreadsTaskRunner::WorkerThreadsTaskRunner(int, node::PlatformDebugLogLevel) (in /usr/bin/node)
   by 0xFFA10F: node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) (in /usr/bin/node)
   by 0xF1A8CD: node::InitializeOncePerProcessInternal(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, node::ProcessInitializationFlags::Flags) (in /usr/bin/node)
   by 0xF1BD8B: node::Start(int, char**) (in /usr/bin/node)
   by 0x74E11C9: (below main) (libc_start_call_main.h:58)

1,280 bytes in 4 blocks are possibly lost in loss record 5,456 of 5,764
   at 0x7101953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x68C85AB: calloc (rtld-malloc.h:44)
   by 0x68C85AB: allocate_dtv (dl-tls.c:370)
   by 0x68C85AB: _dl_allocate_tls (dl-tls.c:629)
   by 0x7554616: allocate_stack (allocatestack.c:429)
   by 0x7554616: pthread_create@@GLIBC_2.34 (pthread_create.c:655)
   by 0x1CD19D0: uv_thread_create_ex (thread.c:172)
   by 0x1CBE24E: init_threads (threadpool.c:234)
   by 0x1CBE24E: init_once (threadpool.c:261)
   by 0x7558ED2: __pthread_once_slow (pthread_once.c:116)
   by 0x1CD1EA8: uv_once (thread.c:433)
   by 0x1CBE496: uv__work_submit (threadpool.c:270)
   by 0x1CC8633: uv_fs_open (fs.c:2028)
   by 0xF85288: node::fs::Open(v8::FunctionCallbackInfo<v8::Value> const&) (in /usr/bin/node)
   by 0x1CEB5E1: Builtins_CallApiCallbackGeneric (in /usr/bin/node)
   by 0x1CE98DD: Builtins_InterpreterEntryTrampoline (in /usr/bin/node)

2,304 bytes in 1 blocks are possibly lost in loss record 5,555 of 5,764
   at 0x70FA828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x68B8EDC: malloc (rtld-malloc.h:56)
   by 0x68B8EDC: _dlfo_mappings_segment_allocate (dl-find_object.c:217)
   by 0x68B8EDC: _dl_find_object_update_1 (dl-find_object.c:671)
   by 0x68B8EDC: _dl_find_object_update (dl-find_object.c:805)
   by 0x68C1C37: dl_open_worker_begin (dl-open.c:756)
   by 0x68B551B: _dl_catch_exception (dl-catch.c:237)
   by 0x68C0D1F: dl_open_worker (dl-open.c:803)
   by 0x68B551B: _dl_catch_exception (dl-catch.c:237)
   by 0x68C1163: _dl_open (dl-open.c:905)
   by 0x754F1A3: dlopen_doit (dlopen.c:56)
   by 0x68B551B: _dl_catch_exception (dl-catch.c:237)
   by 0x68B5668: _dl_catch_error (dl-catch.c:256)
   by 0x754EC82: _dlerror_run (dlerror.c:138)
   by 0x754F25E: dlopen_implementation (dlopen.c:71)
   by 0x754F25E: dlopen@@GLIBC_2.34 (dlopen.c:81)

2,664 bytes in 1 blocks are possibly lost in loss record 5,573 of 5,764
   at 0x70FA828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x68C7BDD: malloc (rtld-malloc.h:56)
   by 0x68C7BDD: allocate_dtv_entry (dl-tls.c:679)
   by 0x68C7BDD: allocate_and_init (dl-tls.c:704)
   by 0x68C7BDD: tls_get_addr_tail (dl-tls.c:904)
   by 0x68CB85B: __tls_get_addr (tls_get_addr.S:55)
   by 0x2E61473E: asio::detail::scheduler::run(std::error_code&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E612360: ??? (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x7207DB3: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
   by 0x7553AA3: start_thread (pthread_create.c:447)
   by 0x75E0A33: clone (clone.S:100)

2,664 bytes in 1 blocks are possibly lost in loss record 5,574 of 5,764
   at 0x70FA828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x68C7BDD: malloc (rtld-malloc.h:56)
   by 0x68C7BDD: allocate_dtv_entry (dl-tls.c:679)
   by 0x68C7BDD: allocate_and_init (dl-tls.c:704)
   by 0x68C7BDD: tls_get_addr_tail (dl-tls.c:904)
   by 0x68CB85B: __tls_get_addr (tls_get_addr.S:55)
   by 0x2E61473E: asio::detail::scheduler::run(std::error_code&) (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E94E044: asio::detail::posix_thread::func<asio::detail::resolver_service_base::work_scheduler_runner>::run() (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x2E61267F: asio_detail_posix_thread_function (in /src/node_modules/@couchbase/couchbase-linux-x64-napi/couchbase-v4.4.6-napi-v6-linux-x64-boringssl.node)
   by 0x7553AA3: start_thread (pthread_create.c:447)
   by 0x75E0A33: clone (clone.S:100)

LEAK SUMMARY:
   definitely lost: 0 bytes in 0 blocks
   indirectly lost: 0 bytes in 0 blocks
     possibly lost: 11,504 bytes in 15 blocks
   still reachable: 133,623,863 bytes in 38,013 blocks
                      of which reachable via heuristic:
                        stdstring          : 98,178 bytes in 2,131 blocks
                        length64           : 2,075 bytes in 17 blocks
        suppressed: 0 bytes in 0 blocks
Reachable blocks (those to which a pointer was found) are not shown.
To see them, rerun with: --leak-check=full --show-leak-kinds=all

Use --track-origins=yes to see where uninitialised values come from
For lists of detected and suppressed errors, rerun with: -s
ERROR SUMMARY: 6693366 errors from 19 contexts (suppressed: 0 from 0)

Do you have any clue on what could be causing this memory error ?

Hi @rfriscca – I tried running some query tests w/ Community 7.2.4 w/o any issues. If some sort of reproducer can be shared that would be best (I understand that can be difficult).

If we provided a way to use a debug build of the SDK (a linux x86_64 version), would you be able to run with that so that we could potentially get more detailed output from the crash?

The stack trace seems to indicate the issue compiling a regex expression in query_request::make_response when the server returns a 5000 (internal error).

If you could run that query in the Query Tab of the UI, it might shed some light on the issue.

Hi @jcasey,

Thanks for your reply, i tried to identify the query causing the crash without success, i logged the query before the crash but each time i run it inside couchbase directly it’s fine.

And if you can provide a debug build i can try to use it, that would be helpful because i can’t pin down which query is causing the issue in our application

Hello again,

We finally found a way to solve the issue concerning the “invalid pointer” part, we downgraded node version from 22.16.0 to 20.19.2 to solve this issue.

I now get more detailed errors :

[InternalServerFailureError: internal server failure] {
   cause: [Error: internal_server_failure (5)] {
     ctxtype: 'query',
     code: 5,
     first_error_code: 5000,
     first_error_message: ' EOF - cause:  EOF',
     client_context_id: '27cbd8-89e3-a346-8518-8d892cd63c5281',

And the query is something that looks like that :

SELECT * FROM `bucket` WHERE model_type="model_type" AND sender="sender_id"

When i run this query directly inside couchbase query tab i most of the time (~90% of the time) get 1 document which is expected, and rarely (~10% of the time) get that EOF error

1 Like

Hello @jcasey @mreiche ,

We still have the issue with the “EOF - cause EOF” errors that happens on 7.2.4 community

I can provide with more infos on the problem :

  • On 6.6.0 the EOF error doesn’t happen
  • We use ForestDB indexes

We tried :

  • Drop index and rebuild in 7.2.4 but it doesn’t fix the issue

The questions we have :

  • Do you have any clue on what’s causing this kind of error ? (is it caused by a document, an index , …?)
  • Do the 6.6.x version is still safe to use and will still receive security updates ?

If you need more informations about the index, the document, or the full N1QL query feel free to send me a private message and i’ll send them to you

And the query is something that looks like that :

SELECT * FROM `bucket` WHERE model_type="model_type" AND sender="sender_id"

What does the query look exactly like? Run that in the query tab of the UI. If it has parameters, they can be entered in the “Settings” on the query tab of the UI.