I have spring boot in java 17 application deployed in AWS Lambda. This application internally uses CSFLE and I use AWS KMS as master key. I frequently keep getting below error:
Caused by: org.springframework.data.mongodb.MongoTransactionException: Command failed with error 225 (TransactionTooOld): 'Retryable write with txnNumber 93 is prohibited on session 00d2f63f-61f4-4bd0-b4d5-c6b3075a84b1 - zGdPT/03WXfbJbQ6/Ib2eRU7o0zXlEAUuHQM1g8zEv8= - - because a newer retryable write with txnNumber 614 has already started on this session.' on server pl-0-ap-south-1.y67s.mongodb.net:1026. The full response is
{
"ok": 0,
"errmsg": "Retryable write with txnNumber 93 is prohibited on session 00d2f63f-61f4-4bd0-b4d5-c6b3075a84b1 - zGdPT/03WXfbJbQ6/Ib2eRU7o0zXlEAUuHQM1g8zEv8= - - because a newer retryable write with txnNumber 614 has already started on this session.",
"code": 225,
"codeName": "TransactionTooOld",
"$clusterTime": {
"clusterTime": {
"$timestamp": {
"t": 1714056398,
"i": 7
}
},
"signature": {
"hash": {
"$binary": {
"base64": "u6jgQ8yX57XW2KxJqfXct2Apmzc=",
"subType": "00"
}
},
"keyId": 7325767949753516037
}
},
"operationTime": {
"$timestamp": {
"t": 1714056398,
"i": 7
}
}
}
And I am just using mongorepository save function and nothing fancy.