[JAVA-4231] NoSuchTransaction Created: 14/Jul/21  Updated: 04/May/22  Resolved: 15/Jul/21

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Unknown
Reporter: el mirón N/A Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: external-user
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

the code is at https://github.com/byhu/springMongoTxTest.git

Test: TxTest.noSuchTransactionRecursive()

Here is a senariao the error occurs

  • The first command starts a transaction.
  • The second command fails when trying to participate the txn the first command started.

It appears the second command came too fast, the first one have not started the transaction yet.

 

Key fields.

lsid – is associated with a session.                              "lsid": {"id": {"$binary":

{"base64": "iH1VdrqKRv20ghDkmqkygg==", "subType": "04"}

}},

txnNumber – is txn number of the session.           "txnNumber": 4

request id – id of the command.                                request id 120

 

2021-07-13 15:22:33.477 DEBUG 10552 — [andler-executor] org.mongodb.driver.protocol.command      : Sending command '{"update": "noSuchTransactionRecursive0", "ordered": true, "$db": "bhu", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1626204153, "i": 60}}, "signature": {"hash": {"$binary": {"base64": "2MKqn5yo2V3q1dledt6XUNfzYyY=", "subType": "00"}}, "keyId": 6959228637484679170}}, "lsid": {"id": {"$binary":

{"base64": "iH1VdrqKRv20ghDkmqkygg==", "subType": "04"}

}}, "txnNumber": 4, "startTransaction": true, "autocommit": false, "updates": [{"q":

{"_id": 30}

, "u": {"_id": 30, "data": "a1 30", "_class": "bhu.tx.A"}, "upsert": true}]}' with request id 119 to database bhu on connection [connectionId\{localValue:19, serverValue:68504}] to server maas-sw-d6-u0055.nam.nsroot.net:37017

2021-07-13 15:22:33.479 DEBUG 10552 — [andler-executor] org.mongodb.driver.protocol.command      : Sending command '{"update": "noSuchTransactionRecursive0", "ordered": true, "$db": "bhu", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1626204153, "i": 60}}, "signature": {"hash": {"$binary": {"base64": "2MKqn5yo2V3q1dledt6XUNfzYyY=", "subType": "00"}}, "keyId": 6959228637484679170}}, "lsid": {"id": {"$binary":

{"base64": "iH1VdrqKRv20ghDkmqkygg==", "subType": "04"}

}}, "txnNumber": 4, "autocommit": false, "updates": [{"q":

{"_id": 31}

, "u": {"_id": 31, "data": "a1 31", "_class": "bhu.tx.A"}, "upsert": true}]}' with request id 120 to database bhu on connection [connectionId\{localValue:18, serverValue:68499}] to server maas-sw-d6-u0055.nam.nsroot.net:37017

2021-07-13 15:22:33.531 DEBUG 10552 — [andler-executor] org.mongodb.driver.protocol.command      : Execution of command with request id 120 failed to complete successfully in 44.83 ms on connection [connectionId\{localValue:18, serverValue:68499}] to server maas-sw-d6-u0055.nam.nsroot.net:37017

 

com.mongodb.MongoCommandException: Command failed with error 251 (NoSuchTransaction): 'Given transaction number 4 does not match any in-progress transactions. The active transaction number is 3' on server maas-sw-d6-u0055.nam.nsroot.net:37017. The full response is {"errorLabels": ["TransientTransactionError"], "operationTime": {"$timestamp": {"t": 1626204153, "i": 41}}, "ok": 0.0, "errmsg": "Given transaction number 4 does not match any in-progress transactions. The active transaction number is 3", "code": 251, "codeName": "NoSuchTransaction", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1626204153, "i": 60}}, "signature": {"hash": {"$binary": {"base64": "2MKqn5yo2V3q1dledt6XUNfzYyY=", "subType": "00"}}, "keyId": 6959228637484679170}}}

                at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:175) ~[mongodb-driver-core-4.2.3.jar:na]

 

 



 Comments   
Comment by Jeffrey Yemin [ 14/Jul/21 ]

Hi there, thank you for reaching out. As this sounds like a support issue, I wanted to give you some resources to get this question answered more quickly:

  • Our MongoDB support portal, located at support.mongodb.com
  • Our MongoDB community portal, located here
  • If you are an Atlas customer, you can review your support options by clicking Support in the top menu bar of the Atlas UI

Just in case you have already opened a support case and are not receiving sufficient help, please let me know and I can facilitate escalating your issue.

Thank you!

Generated at Thu Feb 08 09:01:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.