camunda-community-hub/zeebe-client-node-js

grpc-js support

jwulf opened this issue · 13 comments

jwulf commented

The C grpc package is being deprecated in April, 2021. This task is to track the stability of the grpc-js implementation with a view to switching over to it at the default.

jwulf commented

Current version of grpc-js is 1.2.5.

Tests against Camunda Cloud, so communicating via a TLS-secured nginx proxy.

Node 12.10.0

On Node 12.10.0, the Worker-Failure test exits with SIGFPE.

Node 13.14.0

On Node 13.14.0, Worker-integration exits with:

[1]    4436 segmentation fault

Node 14.2.0

On Node 14.2.0, the Worker-integration test exits with:

Assertion failed: (stream->dep_prev), function nghttp2_stream_dep_remove, file ../deps/nghttp2/lib/nghttp2_stream.c, line 777.

Node 14.15.4

On Node 14.15.4, the Worker-Failure test exits with:

[1]    13143 segmentation fault

Node 15.8.0

On Node 15.8.0, npm i fails with an error:

Undefined variable module_name in binding.gyp while trying to load binding.gyp
jwulf commented

Opened an issue in the grpc-js repository: grpc/grpc-node#1682

jwulf commented

Valgrind command:

ZEEBE_NODE_PUREJS=true NODE_DEBUG=http2,tls valgrind node --expose-internals --expose-gc  node_modules/.bin/jest --runInBand --testPathIgnorePatterns disconnection --detectOpenHandles  Worker-Failure

Output:

TLS 48397: client _init handle? true
HTTP2 48397: Http2Session client: created
TLS 48397: client initRead handle? true buffered? false
HTTP2 48397: Http2Session connect undefined
TLS 48397: client _start handle? true connecting? false requestOCSP? false
TLS 48397: client onhandshakedone
TLS 48397: client _finishInit handle? true alpn h2 servername 3b640f45-0dcd-469c-8551-7f68a5d4f54b.zeebe.camunda.io
TLS 48397: client emit secureConnect. authorized: true
HTTP2 48397: Http2Session client: setting up session handle
HTTP2 48397: Http2Session client: sending settings
HTTP2 48397: Http2Session client: submitting settings
HTTP2 48397: Http2Session client: initiating request
HTTP2 48397: Http2Session client: connected, initializing request
HTTP2 48397: Http2Stream 1 [Http2Session client]: shutting down writable on last write
HTTP2 48397: Http2Stream 1 [Http2Session client]: shutting down writable on _final
HTTP2 48397: Http2Stream 1 [Http2Session client]: shutdownWritable() already called
HTTP2 48397: Http2Session client: settings received
HTTP2 48397: Http2Stream 1 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 1 [Http2Session client]: emitting stream 'response' event
HTTP2 48397: Http2Stream 1 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 1 [Http2Session client]: emitting stream 'trailers' event
HTTP2 48397: Http2Stream 1 [Http2Session client]: closed with code 0, closed true, readable true
HTTP2 48397: Http2Stream 1 [Http2Session client]: destroying stream
HTTP2 48397: Http2Session client: initiating request
HTTP2 48397: Http2Session client: connected, initializing request
HTTP2 48397: Http2Stream 3 [Http2Session client]: shutting down writable on last write
HTTP2 48397: Http2Stream 3 [Http2Session client]: shutting down writable on _final
HTTP2 48397: Http2Stream 3 [Http2Session client]: shutdownWritable() already called
HTTP2 48397: Http2Stream 3 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 3 [Http2Session client]: emitting stream 'response' event
HTTP2 48397: Http2Stream 3 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 3 [Http2Session client]: emitting stream 'trailers' event
HTTP2 48397: Http2Stream 3 [Http2Session client]: closed with code 0, closed true, readable true
HTTP2 48397: Http2Stream 3 [Http2Session client]: destroying stream
HTTP2 48397: Http2Session client: initiating request
HTTP2 48397: Http2Session client: connected, initializing request
HTTP2 48397: Http2Session client: initiating request
HTTP2 48397: Http2Session client: connected, initializing request
HTTP2 48397: Http2Stream 5 [Http2Session client]: shutting down writable on last write
HTTP2 48397: Http2Stream 7 [Http2Session client]: shutting down writable on last write
HTTP2 48397: Http2Stream 5 [Http2Session client]: shutting down writable on _final
HTTP2 48397: Http2Stream 5 [Http2Session client]: shutdownWritable() already called
HTTP2 48397: Http2Stream 7 [Http2Session client]: shutting down writable on _final
HTTP2 48397: Http2Stream 7 [Http2Session client]: shutdownWritable() already called
HTTP2 48397: Http2Stream 5 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 5 [Http2Session client]: emitting stream 'response' event
HTTP2 48397: Http2Stream 5 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 5 [Http2Session client]: emitting stream 'trailers' event
HTTP2 48397: Http2Stream 5 [Http2Session client]: closed with code 0, closed true, readable true
HTTP2 48397: Http2Stream 5 [Http2Session client]: destroying stream
HTTP2 48397: Http2Stream 7 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 7 [Http2Session client]: emitting stream 'response' event
HTTP2 48397: Http2Session client: initiating request
HTTP2 48397: Http2Session client: connected, initializing request
HTTP2 48397: Http2Stream 9 [Http2Session client]: shutting down writable on last write
HTTP2 48397: Http2Stream 7 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 7 [Http2Session client]: emitting stream 'trailers' event
HTTP2 48397: Http2Stream 7 [Http2Session client]: closed with code 0, closed true, readable false
HTTP2 48397: Http2Stream 7 [Http2Session client]: destroying stream
HTTP2 48397: Http2Stream 9 [Http2Session client]: shutting down writable on _final
HTTP2 48397: Http2Stream 9 [Http2Session client]: shutdownWritable() already called
HTTP2 48397: Http2Session client: initiating request
HTTP2 48397: Http2Session client: connected, initializing request
HTTP2 48397: Http2Stream 11 [Http2Session client]: shutting down writable on last write
HTTP2 48397: Http2Stream 9 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 9 [Http2Session client]: emitting stream 'response' event
HTTP2 48397: Http2Stream 9 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 9 [Http2Session client]: emitting stream 'trailers' event
HTTP2 48397: Http2Stream 9 [Http2Session client]: closed with code 0, closed true, readable true
HTTP2 48397: Http2Stream 9 [Http2Session client]: destroying stream
HTTP2 48397: Http2Stream 11 [Http2Session client]: shutting down writable on _final
HTTP2 48397: Http2Stream 11 [Http2Session client]: shutdownWritable() already called
HTTP2 48397: Http2Session client: initiating request
HTTP2 48397: Http2Session client: connected, initializing request
HTTP2 48397: Http2Stream 13 [Http2Session client]: shutting down writable on last write
HTTP2 48397: Http2Stream 13 [Http2Session client]: shutting down writable on _final
HTTP2 48397: Http2Stream 13 [Http2Session client]: shutdownWritable() already called
HTTP2 48397: Http2Stream 13 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 13 [Http2Session client]: emitting stream 'response' event
HTTP2 48397: Http2Stream 13 [Http2Session client]: closed with code 8, closed true, readable false
HTTP2 48397: Http2Stream 13 [Http2Session client]: destroying stream
HTTP2 48397: Http2Session client: initiating request
HTTP2 48397: Http2Session client: connected, initializing request
HTTP2 48397: Http2Stream 15 [Http2Session client]: shutting down writable on last write

 RUNS  src/__tests__/integration/Worker-Failure.spec.ts
==48397== Invalid read of size 1
==48397==    at 0x1985A2A: nghttp2_session_mem_recv (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA7C18: node::http2::Http2Session::ConsumeHTTP2Data() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA7F6D: node::http2::Http2Session::OnStreamRead(long, uv_buf_t const&) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xC2B54F: node::crypto::TLSWrap::ClearOut() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xC2BE8F: node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xB5F557: node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x14797D6: uv__read (stream.c:1239)
==48397==    by 0x147A18F: uv__stream_io (stream.c:1306)
==48397==    by 0x1480C74: uv__io_poll (linux-core.c:462)
==48397==    by 0x146E817: uv_run (core.c:385)
==48397==    by 0x9C4024: node::SpinEventLoop(node::Environment*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xABC14F: node::NodeMainInstance::Run(node::EnvSerializeInfo const*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==  Address 0x7f4a625 is 245 bytes inside a block of size 248 free'd
==48397==    at 0x43A7A3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==48397==    by 0xAB3B87: node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::ReallocImpl(void*, unsigned long, void*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAB3C32: node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::FreeImpl(void*, void*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x197F2F0: nghttp2_session_close_stream (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1981079: session_after_frame_sent1 (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1984985: nghttp2_session_mem_send (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA558A: node::http2::Http2Session::SendPendingData() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA6593: node::http2::Http2Stream::SubmitRstStream(unsigned int) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA674D: node::http2::Http2Stream::RstStream(v8::FunctionCallbackInfo<v8::Value> const&) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xCD097A: 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) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xCD1F2B: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xCD25A5: v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==  Block was alloc'd at
==48397==    at 0x43A67F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==48397==    by 0xAB3DC0: node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::MallocImpl(unsigned long, void*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x197E790: nghttp2_session_open_stream (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1983C3D: nghttp2_session_mem_send_internal (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x198496A: nghttp2_session_mem_send (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA558A: node::http2::Http2Session::SendPendingData() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA6543: node::CallbackQueue<void, node::Environment*>::CallbackImpl<node::http2::Http2Session::MaybeScheduleWrite()::{lambda(node::Environment*)#1}>::Call(node::Environment*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xA03383: node::Environment::RunAndClearNativeImmediates(bool) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xA03A94: node::Environment::CheckImmediate(uv_check_s*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1475F48: uv__run_check (loop-watcher.c:67)
==48397==    by 0x146E827: uv_run (core.c:394)
==48397==    by 0x9C4024: node::SpinEventLoop(node::Environment*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==
==48397== Invalid read of size 1
==48397==    at 0x1985A2F: nghttp2_session_mem_recv (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA7C18: node::http2::Http2Session::ConsumeHTTP2Data() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA7F6D: node::http2::Http2Session::OnStreamRead(long, uv_buf_t const&) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xC2B54F: node::crypto::TLSWrap::ClearOut() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xC2BE8F: node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xB5F557: node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x14797D6: uv__read (stream.c:1239)
==48397==    by 0x147A18F: uv__stream_io (stream.c:1306)
==48397==    by 0x1480C74: uv__io_poll (linux-core.c:462)
==48397==    by 0x146E817: uv_run (core.c:385)
==48397==    by 0x9C4024: node::SpinEventLoop(node::Environment*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xABC14F: node::NodeMainInstance::Run(node::EnvSerializeInfo const*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==  Address 0x7f4a625 is 245 bytes inside a block of size 248 free'd
==48397==    at 0x43A7A3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==48397==    by 0xAB3B87: node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::ReallocImpl(void*, unsigned long, void*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAB3C32: node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::FreeImpl(void*, void*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x197F2F0: nghttp2_session_close_stream (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1981079: session_after_frame_sent1 (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1984985: nghttp2_session_mem_send (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA558A: node::http2::Http2Session::SendPendingData() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA6593: node::http2::Http2Stream::SubmitRstStream(unsigned int) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA674D: node::http2::Http2Stream::RstStream(v8::FunctionCallbackInfo<v8::Value> const&) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xCD097A: 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) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xCD1F2B: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xCD25A5: v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==  Block was alloc'd at
==48397==    at 0x43A67F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==48397==    by 0xAB3DC0: node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::MallocImpl(unsigned long, void*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x197E790: nghttp2_session_open_stream (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1983C3D: nghttp2_session_mem_send_internal (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x198496A: nghttp2_session_mem_send (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA558A: node::http2::Http2Session::SendPendingData() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA6543: node::CallbackQueue<void, node::Environment*>::CallbackImpl<node::http2::Http2Session::MaybeScheduleWrite()::{lambda(node::Environment*)#1}>::Call(node::Environment*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xA03383: node::Environment::RunAndClearNativeImmediates(bool) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xA03A94: node::Environment::CheckImmediate(uv_check_s*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1475F48: uv__run_check (loop-watcher.c:67)
==48397==    by 0x146E827: uv_run (core.c:394)
==48397==    by 0x9C4024: node::SpinEventLoop(node::Environment*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==
==48397== Invalid read of size 4
==48397==    at 0x1985A3D: nghttp2_session_mem_recv (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA7C18: node::http2::Http2Session::ConsumeHTTP2Data() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA7F6D: node::http2::Http2Session::OnStreamRead(long, uv_buf_t const&) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xC2B54F: node::crypto::TLSWrap::ClearOut() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xC2BE8F: node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xB5F557: node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x14797D6: uv__read (stream.c:1239)
==48397==    by 0x147A18F: uv__stream_io (stream.c:1306)
==48397==    by 0x1480C74: uv__io_poll (linux-core.c:462)
==48397==    by 0x146E817: uv_run (core.c:385)
==48397==    by 0x9C4024: node::SpinEventLoop(node::Environment*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xABC14F: node::NodeMainInstance::Run(node::EnvSerializeInfo const*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==  Address 0x7f4a5f8 is 200 bytes inside a block of size 248 free'd
==48397==    at 0x43A7A3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==48397==    by 0xAB3B87: node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::ReallocImpl(void*, unsigned long, void*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAB3C32: node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::FreeImpl(void*, void*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x197F2F0: nghttp2_session_close_stream (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1981079: session_after_frame_sent1 (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1984985: nghttp2_session_mem_send (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA558A: node::http2::Http2Session::SendPendingData() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA6593: node::http2::Http2Stream::SubmitRstStream(unsigned int) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA674D: node::http2::Http2Stream::RstStream(v8::FunctionCallbackInfo<v8::Value> const&) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xCD097A: 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) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xCD1F2B: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xCD25A5: v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==  Block was alloc'd at
==48397==    at 0x43A67F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==48397==    by 0xAB3DC0: node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::MallocImpl(unsigned long, void*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x197E790: nghttp2_session_open_stream (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1983C3D: nghttp2_session_mem_send_internal (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x198496A: nghttp2_session_mem_send (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA558A: node::http2::Http2Session::SendPendingData() (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xAA6543: node::CallbackQueue<void, node::Environment*>::CallbackImpl<node::http2::Http2Session::MaybeScheduleWrite()::{lambda(node::Environment*)#1}>::Call(node::Environment*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xA03383: node::Environment::RunAndClearNativeImmediates(bool) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0xA03A94: node::Environment::CheckImmediate(uv_check_s*) (in /home/merlin/.nvm/versions/node/v15.10.0/bin/node)
==48397==    by 0x1475F48: uv__run_check (loop-watcher.c:67)
==48397==    by 0x146E827: uv_run (core.c:394)
HTTP2 48397: Http2Stream 11 [Http2Session client]: closed with code 8, closed true, readable truenode/v15.10.0/bin/node)
HTTP2 48397: Http2Stream 11 [Http2Session client]: destroying stream
HTTP2 48397: Http2Stream 15 [Http2Session client]: shutting down writable on _final
HTTP2 48397: Http2Stream 15 [Http2Session client]: shutdownWritable() already called
HTTP2 48397: Http2Stream 15 [Http2Session client]: headers received
HTTP2 48397: Http2Stream 15 [Http2Session client]: emitting stream 'response' event
HTTP2 48397: Http2Session client: marking session closed
HTTP2 48397: Http2Session client: submitting goaway
HTTP2 48397: Http2Stream 15 [Http2Session client]: closed with code 0, closed true, readable false
HTTP2 48397: Http2Stream 15 [Http2Session client]: destroying stream
HTTP2 48397: Http2Session client: destroying
HTTP2 48397: Http2Session client: start closing/destroying undefined
HTTP2 48397: Http2Session client: finishSessionClose
 FAIL  src/__tests__/integration/Worker-Failure.spec.ts (356.001 s)
  ✕ Causes a retry with complete.failure() (102016 ms)
  ✓ Does not fail a workflow when the handler throws, by default (44295 ms)
  ✓ Fails a workflow when the handler throws and options.failWorkflowOnException is set (23735 ms)

  ● Causes a retry with complete.failure()

    : Timeout - Async callback was not invoked within the 60000 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 60000 ms timeout specified by jest.setTimeout.Error:

      37 | })
      38 |
    > 39 | test('Causes a retry with complete.failure()', () =>
         | ^
      40 | 	new Promise(async resolve => {
      41 | 		const { bpmn, processId, taskTypes } = createUniqueTaskType({
      42 | 			bpmnFilePath: './src/__tests__/testdata/Worker-Failure1.bpmn',

      at new Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
      at Object.<anonymous> (src/__tests__/integration/Worker-Failure.spec.ts:39:1)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 2 passed, 3 total
Snapshots:   0 total
Time:        371.582 s
Ran all test suites matching /Worker-Failure/i.
HTTP2 48397: Http2Session client: finishSessionClose socket end undefined undefined
==48397==
==48397== HEAP SUMMARY:
==48397==     in use at exit: 1,048,855 bytes in 10,603 blocks
==48397==   total heap usage: 822,268 allocs, 811,665 frees, 919,597,869 bytes allocated
==48397==
==48397== LEAK SUMMARY:
==48397==    definitely lost: 0 bytes in 0 blocks
==48397==    indirectly lost: 0 bytes in 0 blocks
==48397==      possibly lost: 855 bytes in 7 blocks
==48397==    still reachable: 1,048,000 bytes in 10,596 blocks
==48397==                       of which reachable via heuristic:
==48397==                         multipleinheritance: 48 bytes in 1 blocks
==48397==         suppressed: 0 bytes in 0 blocks
==48397== Rerun with --leak-check=full to see details of leaked memory
==48397==
==48397== For lists of detected and suppressed errors, rerun with: -s
==48397== ERROR SUMMARY: 4 errors from 3 contexts (suppressed: 0 from 0)
jwulf commented

It segfaults on:

NZ
GCE AU
GCE SG
GCE JP
GCE HK
GCE BR
GCE US (LA)

It does not segfault from:

GCE US (Iowa)
GCE EU1 (Belgium)

jwulf commented

Testing the pure JS client from NZ against a vanilla broker in Belgium segfaults. It's distance or some other geographical network factor.

jwulf commented

Here is a script for scaffolding a GCE Ubuntu 20.10 VM to run the test against Camunda Cloud:

sudo apt install -y build-essential
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
source ~/.bashrc
nvm install 14
git clone https://github.com/camunda-community-hub/zeebe-client-node-js.git
cd zeebe-client-node-js
npm i

# Set Camunda Cloud env variables

ZEEBE_NODE_PUREJS=true node_modules/.bin/jest Worker-Failure

Undefined variable module_name in binding.gyp while trying to load binding.gyp

This looks like an error related to the native module. I suspect that it should go away when we don't import anything from grpc package.

Is there any timeline / plan to remove grpc from the dependencies? It is causing us quite some headaches as it is the only non-pure-js dependency left.

jwulf commented

Is there any timeline / plan to remove grpc from the dependencies? It is causing us quite some headaches as it is the only non-pure-js dependency left.

No, there is not. I need assistance to fix this.

The grpc-node maintainers said:

A segmentation fault in Node is, in my view, unambiguously a bug in Node itself, so I suggest filing an issue against Node (https://github.com/nodejs/node). When you do so, you should probably include a C-level stacktrace, which can be obtained using a tool like gdb. Some code that reproduces the error would probably also help.

jwulf commented

Node 16.13.1 has fixed this issue.

Now the grpc-js works with a caveat: the onConnection behaviour is distinct from the C-based library.

3 tests fail out of 136:

  • Does not emit the ready event if there is no broker (API0 and API1)
  • Does not call the onReady handler if there is no broker

So some modifications will be necessary to align the behaviours.

jwulf commented

If I remove the c-based library support, then it will make Node 16.13.1 a minimum pre-requisite...

jwulf commented

It looks like this is the Node issue that fixed it: nodejs/node#38964.

So it should be fixed from 16.6.1, 14.17.5, and 12.22.5.

Node 16 - 16.6.0+

It works with 16.9.1 - the version bundled with Electron 16.
It works with 16.6.0 - looks like the fix got back-ported for the 16.6.z release
Does not work with 16.5.0
Does not work with 16.0.0

Node 14 - 14.17.5+

It works with 14.17.5.
Does not work with 14.17.0 - looks like the fix did not get back-ported for the 14.17.z release.

Node 12 - Node - 12.22.5+

It works with 12.22.5.
Does not work with 12.22.0

jwulf commented

I'm going to bite the bullet and release 2.4.0 with pure JS gRPC only.

2.0.0-2.3.0 versions of the package were released two years ago, under the old numbering scheme.