@grpc/grpc-js Abort on ClientReadableStream cancel
Problem description
invoking ClientReadableStream.cancel() cause abort
node[8728]: ../src/node_http2.cc:448:void node::http2::Http2Session::CheckAllocatedSize(size_t) const: Assertion `(current_nghttp2_memory_) >= (previous_size)' failed.
1: 0xa03530 node::Abort() [node]
2: 0xa035ae [node]
3: 0xa3ba6b node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::ReallocImpl(void*, unsigned long, void*) [node]
4: 0xa3bc43 node::mem::NgLibMemoryManager<node::http2::Http2Session, nghttp2_mem>::FreeImpl(void*, void*) [node]
5: 0x1865d81 nghttp2_session_close_stream [node]
6: 0x186c4e4 nghttp2_session_mem_recv [node]
7: 0xa2faa9 node::http2::Http2Session::ConsumeHTTP2Data() [node]
8: 0xa2fe18 node::http2::Http2Session::OnStreamRead(long, uv_buf_t const&) [node]
9: 0xada258 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [node]
10: 0x1385197 [node]
11: 0x1385b50 [node]
12: 0x138c545 [node]
13: 0x137a398 uv_run [node]
14: 0xa438d4 node::NodeMainInstance::Run() [node]
15: 0x9d1735 node::Start(int, char**) [node]
16: 0x7fd5025050b3 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
17: 0x96971c [node]
Aborted
but when I use 'grpc' module with same code, there is no abort.
Reproduction steps
invoke ClientReadableStream.cancel()
Environment
- OS name, version and architecture: [WSL Ubuntu 20.04.1 amd64]
- Node version [14.15.1]
- Node installation method [nvm]
- If applicable, compiler version []
- Package name and version [@grpc/[email protected]]
Additional context
I believe this may be related to #1464.
Wrapping the .cancel() call with setTimeout/setImmediate seems to mitigate the error.
Wrapping the
.cancel()call withsetTimeout/setImmediateseems to mitigate the error.
this works for me
I've opened an issue against nodejs as I ran into a similar issue https://github.com/nodejs/node/issues/38964
I'm investigating it there.
ping @jasnell: see the stacktrace? Does that tell you anything right away?
This is a Node bug and it appears to have been fixed in Node.
This issue has not been completely fixed in node https://github.com/nodejs/node/issues/38964 is still open
Yes, I see that that issue was reopened since I made that comment. It is still a Node bug, not a grpc-js bug.