question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Node randomly exits even if Google PubSub subscription is opened

See original GitHub issue

Problem description

Node sample app running behind a proxy randomly exits without any close/error event

Reproduction steps

We have a Node app which uses Google PubSub module (2.18.5). Few amount of time per day, we stop receiving messages. We never encounter subscription onClose or onError events. In order to troubleshoot, we wrote a small code to try to reproduce the behavior. We have a similar behavior. Few amount of time per day, the app exits properly without passing through onClose/onError subscription functions. The difference of behavior between our app and the sample code is our app has more stuff to do. That’s why it just stopped receiving messages instead of exiting. We already opened a case to Google PubSub team. They never see disconnections on their side. Our issue is probably a network issue due to the proxy but our concern is we never trigger any onClose/onError events. So, we can’t properly catch them. We verified that onMessage,onClose and onError subscription listeners are still present during process onExit event. We don’t understand why Node exits in our sample code or why we stop receiving message in our app as the subscription streams connections seem to have been re-established. This behavior is completely random.

Environment

  • OS name, version and architecture: [e.g. Linux Ubuntu 18.04 amd64] node docker image node:16.14.0-alpine3.15 amd64 running on Kubernetes cluster 1.20
  • Node version [e.g. 8.10.0] 16.14.0 LTS
  • Node installation method [e.g. nvm] docker image
  • If applicable, compiler version [e.g. clang 3.8.0-2ubuntu4]
  • Package name and version [e.g. gRPC@1.12.0] @grpc/grpc-js@1.5.5

Additional context

Some interesting logs

call_stream | [705] cancelWithStatus code: 4 details: "Deadline exceeded"
call_stream | [705] close http2 stream with code 8
call_stream | [705] HTTP/2 stream closed with code 8
call_stream | [708] ended with status: code=14 details="Connection dropped"

full log: elastic_result.log code sample: index.js.txt

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:22 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
WeetA34commented, Jul 13, 2022

Hello @levidyrek I’m sorry to hear that but I’m “happy” to know I’m not the only one to have the issue 😄

1reaction
levidyrekcommented, Jul 13, 2022

FWIW, I am also experiencing this issue. The kubernetes container listening on the pubsub subscription randomly restarts with exit code 0 several times a day. The close and error event handlers are not run.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting | Cloud Pub/Sub Documentation
Learn about troubleshooting steps that you might find helpful if you run into problems using Pub/Sub. Cannot create a subscription.
Read more >
In which case does Google Cloud Pub/Sub close a ...
1 Answer 1 · The subscription was deleted. · The subscriber no longer has permission to subscribe to the subscription. · There was...
Read more >
No traces when Function crashes - Node js runtime [155215191]
I've noticed that sometimes I have to have quite a long sleep in the except-block (like 10s) to make the error show in...
Read more >
How to: Publish a message and subscribe to a topic | Dapr Docs
When you run dapr init , Dapr creates a default Redis pubsub.yaml and ... an event subscription to topic orders , for the...
Read more >
Things I wish I knew about Google Cloud Pub/Sub: Part 2
However, you may face increased latency (time between when publish is called in the client and when that publish is acknowledged by the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found