cookie-cutter icon indicating copy to clipboard operation
cookie-cutter copied to clipboard

Fix gRPC response stream [Replace AsyncPipe with BoundedPriorityQueue]

Open prachi30 opened this issue 3 years ago • 1 comments

Currently send method for gRPC response stream does not await while adding messages to async pipe and that is causing issues in case when a new message is added to response stream while the last one is still pending.

Here's the stack trace: fields":{"stack":["Error: there is already a pending send call\n at /usr/src/node_modules/@walmartlabs/cookie-cutter-core/dist/utils/AsyncPipe.js:29:24\n at new Promise ()\n at AsyncPipe.send (/usr/src/node_modules/@walmartlabs/cookie-cutter-core/dist/utils/AsyncPipe.js:24:16)\n at GrpcResponseStream.send (/usr/src/node_modules/@walmartlabs/cookie-cutter-grpc/dist/internal/GrpcResponseStream.js:39:26)\n

prachi30 avatar Jun 21 '21 14:06 prachi30

After some investigation, we could not determine why the above error would occur in the service with its current settings. The adding an await as suggested did not solve the issue in testing.

As a potential solution, we can replace the AsyncPipe with a BoundedPriorityQueue.

plameniv avatar Jul 27 '21 14:07 plameniv