-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.2.7
-
Component/s: None
-
None
-
Empty show more show less
We currently append a TransientTransactionError label to any MongoNetworkError, regardless of whether it’s in a transaction or not. This is confusing and makes it seem as though we are implicitly creating a transaction. We should only add this label when we are within a transaction.
daniel.aprahamian's suggested fix in lib/core/wireprotocol/command.js:
const commandResponseHandler = inTransaction ? function(err) { // Here is what we are changing if (err && err instanceof MongoNetworkError && !err.hasErrorLabel('TransientTransactionError') < 0) { err.errorLabels.push('TransientTransactionError') } // Changes end if ( !cmd.commitTransaction && err && err instanceof MongoError && err.hasErrorLabel('TransientTransactionError') ) { session.transaction.unpinServer(); } return callback.apply(null, arguments); } : callback;