Cannot continue txnId A for session with txnId B

MongoDB version: 4.2
Go MongoDriver version: 1.4.3
Go version: 1.13

Recently started see this error pop up

(NoSuchTransaction) cannot continue txnId 4 for session 6022a452-72de-46c6-afa6-fe9247ed38c9 - 
47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= with txnId 13

I noticed from Product Considerations that this error can occur when using a driver that doesn’t support 4.2 against a 4.2 Mongos, but driver v1.4.3 supports 4.2.
I’ve verified my code isn’t starting new transactions over an existing session.

My next step is upgrading my driver to latest, which certainly might fix it, but I want to cover my bases by posting here as well.

What are the possible causes of this error beyond driver/db mismatch?

Hi Brian!
Thanks for reporting this issue. Are you running with multiple mongos instances? My initial instinct is that there’s a driver bug where we’re sending the transaction to the wrong mongos, but its hard to tell without more information.
Can you give any more information about how you got this error? Preferably a minimal reproducible example, but any information is helpful.

2 Likes

Hi Isabella!

We upgraded our mongo driver from 1.4.3 to 1.5.2 and we saw decreased cases of this, but after some time in prod, we’re seeing more consistency in the error message. Before, where it would have specific transaction IDs, we’re now seeing the -1/1 combo from production considerations:
(NoSuchTransaction) cannot continue txnId -1 for session 4fae1d9c-dfe5-48f3-b42f-dbaeb750540c - 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= with txnId {X}

I’m going to try to come up with minimum reproducible code, but between the demands my job and that we only have multiple mongos instances in our higher level environments, it might be a bit.