You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using nats.node with Bun, and it seems that my application sometimes crashes because of NATS.
It will be in the middle of some database operation and crash, so it doesn't seem related to fetch.
I've also tried adding some await Bun.sleep(10) to allow task switching for NATS, so I don't think that's the problem.
I'm calling msg.working() every 5s with a setInterval function.
I'm not sure what the heartbeat is for. Can it be disabled? I'm only interested in the working() and ack() calls.
The consumer is configured with ack_wait: 5 * 60 * 10 ** 9, // 5min.
Is it possible to use NATS on an unreliable network connection? Or does it require consistent and very frequent heartbeats?
but when the work is started, which involves a lot of fetching with long timeouts (e.g. 10-30 seconds), it may be causing Nats to fail heartbeats, and the internal nats code seems to stop on failures, if I'm reading this right...
// if we are not a consume, give up - this was masked by an
// external timer on fetch - the hb is a more reliable timeout
// since it requires 2 to be missed - this creates an edge case
// that would timeout the client longer than they would expect: we
// could be waiting for one more message, nothing happens, and
// now we have to wait for 2 missed hbs, which would be 1m (max), so
// there wouldn't be a fail fast.
this.stop(new jserrors_1.JetStreamError("heartbeats missed"));
@erikschul is your API blocking? The heartbeats missed, is directly in response to your client likely being partitioned? is this possible? where you have a connection but part of it goes silent? For your pattern the more resilient is doing next() as you have done. consume() is intended for stable processes.
Observed behavior
I'm using nats.node with Bun, and it seems that my application sometimes crashes because of NATS.
It will be in the middle of some database operation and crash, so it doesn't seem related to fetch.
I've also tried adding some
await Bun.sleep(10)
to allow task switching for NATS, so I don't think that's the problem.I'm calling
msg.working()
every 5s with a setInterval function.I'm not sure what the heartbeat is for. Can it be disabled? I'm only interested in the working() and ack() calls.
The consumer is configured with
ack_wait: 5 * 60 * 10 ** 9, // 5min
.Is it possible to use NATS on an unreliable network connection? Or does it require consistent and very frequent heartbeats?
nats js debug console output:
Using the debugging code in the README:
It seems that when there are no messages, it works fine:
but when the work is started, which involves a lot of fetching with long timeouts (e.g. 10-30 seconds), it may be causing Nats to fail heartbeats, and the internal nats code seems to stop on failures, if I'm reading this right...
Expected behavior
No error.
Server and client version
server: 2.10.22
"@nats-io/jetstream": "^3.0.0-37",
"@nats-io/nats-core": "^3.0.0-50",
"@nats-io/transport-node": "^3.0.0-35",
Host environment
No response
Steps to reproduce
No response
The text was updated successfully, but these errors were encountered: