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
# nats req -H Nats-Msg-Id:1 ORDERS.new hello1
05:16:03 Sending request on "ORDERS.new"
05:16:03 Received on "_INBOX.r0yfSLDniVtFWbJXzrdkyZ.OGFSlLFI" rtt 1.003804ms
{"stream":"ORDERS","seq":1}
# nats req -H Nats-Msg-Id:1 ORDERS.new hello2 # duplicate
05:16:03 Sending request on "ORDERS.new"
05:16:03 Received on "_INBOX.Gu8EQT3FXwoZTn2pXW8oRb.MPEuuDBY" rtt 973.104µs
{"stream":"ORDERS","seq":1,"duplicate": true}
First attempt of new message after duplicate
# nats req -H Nats-Msg-Id:2 ORDERS.new hello3 # new msg always fails after duplicate
05:16:03 Sending request on "ORDERS.new"
05:16:03 Received on "_INBOX.9MXKkqfTzruzga2f9zztXo.nRG0SrMJ" rtt 1.058504ms
{"error":{"code":503,"description":"expected sequence does not match store"},"stream":"ORDERS","seq":0}
Second attempt of new message after duplicate
# nats req -H Nats-Msg-Id:2 ORDERS.new hello3 # retry 1 fails
05:16:03 Sending request on "ORDERS.new"
05:16:03 Received on "_INBOX.oNSsmTtzsFQ2kQKyypIpAp.HStDnu1s" rtt 1.014404ms
{"error":{"code":503,"description":"expected stream sequence does not match"},"stream":"ORDERS","seq":0}
Third attempt of new message after duplicate
# nats req -H Nats-Msg-Id:2 ORDERS.new hello3 # retry 2 succeeds
05:16:04 Sending request on "ORDERS.new"
05:16:04 Received on "_INBOX.9V2tVYbsCj5QAYZUdglPSz.vRWPMBoS" rtt 946.503µs
{"stream":"ORDERS","seq":2}
I can confirm this is happening, and in a cluster even worse:
May 24 08:57:42 n2-sfo nats-server[1343]: [1] [INF] JetStream cluster new consumer leader for 'one > ORDERS_65 > C3'
May 24 08:57:44 n3-sfo nats-server[1362]: [1] [INF] JetStream cluster new consumer leader for 'one > ORDERS_14 > C1'
May 24 08:57:49 n3-nyc nats-server[1345]: [1] [ERR] JetStream failed to store a msg on stream 'one > ORDERS_1' - expected sequence does not match store
May 24 08:57:49 n1-nyc nats-server[1346]: [1] [ERR] JetStream failed to store a msg on stream 'one > ORDERS_1' - expected sequence does not match store
May 24 08:57:49 n2-nyc nats-server[1349]: [1] [ERR] JetStream failed to store a msg on stream 'one > ORDERS_1' - expected sequence does not match store
May 24 08:57:49 n3-nyc nats-server[1345]: [1] [WRN] Got stream sequence mismatch for 'one > ORDERS_1'
May 24 08:57:49 n1-nyc nats-server[1346]: [1] [WRN] Got stream sequence mismatch for 'one > ORDERS_1'
May 24 08:57:49 n2-nyc nats-server[1349]: [1] [WRN] Got stream sequence mismatch for 'one > ORDERS_1'
May 24 08:57:49 n2-nyc nats-server[1349]: [1] [WRN] Resetting stream 'one > ORDERS_1'
May 24 08:57:49 n3-nyc nats-server[1345]: [1] [WRN] Resetting stream 'one > ORDERS_1'
May 24 08:57:49 n1-nyc nats-server[1346]: [1] [WRN] Resetting stream 'one > ORDERS_1'
May 24 08:57:51 n1-nyc nats-server[1346]: [1] [INF] JetStream cluster new stream leader for 'one > ORDERS_1'
This happens when I publish the first non dupe, definitely something bad giong on here.
When we had a duplicate detected in R>1 mode we set the skip sequence indicator but were not using that when dealing with underlying store.
Signed-off-by: Derek Collison <derek@nats.io>
When using a msg id to prevent duplicates, an error is always returned when sending a non duplicate after having received a duplicate ack result :
First message + duplicate :
First attempt of new message after duplicate
Second attempt of new message after duplicate
Third attempt of new message after duplicate
Configs :
Docker images used and start commands:
Logs :
The text was updated successfully, but these errors were encountered: