-
Notifications
You must be signed in to change notification settings - Fork 183
Closed
Labels
defectSuspected defect such as a bug or regressionSuspected defect such as a bug or regression
Description
Observed behavior
When using KeyValue with per-message TTL enabled, the following code snippet returns a non-null value even though the server has already deleted the key due to expiration:
var kve = kv.get(key);
// kve.getValue() is null
return kve != null && kve.getValue() != null
? converter.read(kve.getValue(), Object.class)
: null;Expected behavior
keyValue.get(key) should return null when the key has expired and been deleted by the server.
Server and client version
Server:
Version: 2.11.2
Git: [55efd1d]
Name: NBTPDMICKE5D3UTWIT4X3YFODFCSLTWJDX6HSQO5OUBAWPQ5RXXQ2EXM
Node: LmBR30Xm
ID: NBTPDMICKE5D3UTWIT4X3YFODFCSLTWJDX6HSQO5OUBAWPQ5RXXQ2EXM
Client: 2.21.2
Host environment
No response
Steps to reproduce
nats kv info long-cache:
Bucket Name : long-cache
History Kept : 1
Values Stored : 1
Compressed : false
Per-Key TTL Supported : true
Limit Marker TTL : 1d0h0m0s
Backing Store Kind : JetStream
Description : Used for cache
Bucket Size : 327 B
Maximum Bucket Size : unlimited
Maximum Value Size : unlimited
Maximum Age : 1d0h0m0s
JetStream Stream : KV_long-cache
Storage : Memory
nats kv ls long-cache:
No keys found in bucket
kv.create(key, value, MessageTtl.seconds(20));
Sometimes we see:
Error while putting cache entry with key 'val.57c3e7f5bbee56f876e4cece2405b608'. wrong last sequence: 2 [10071]
Metadata
Metadata
Assignees
Labels
defectSuspected defect such as a bug or regressionSuspected defect such as a bug or regression
