Mongos hang, how to clean a hang operation

I try to update shard key in a transaction using mongo shell, when i try to commitTransaction,i get the following error:

Transaction was aborted :: caused by :: from shard rs_shard03 :: caused by :: ‘prepareTransaction’ is not supported for replica sets with arbiters".

then i try to query or use currentOp() from mongos, all operations in mongos hang.
then i try to kill all mongod mongos processes, and restart them, but all operations from mongos still hang, i can ses an operation 449052 in sh_shard03 using currentOp(), currentOp shows a msg with this

operation: “errmsg” : “from shard rs_shard03 :: caused by :: ‘prepareTransaction’ is not supported for replica sets with arbiters”

i try to killOp(“rs_shard03:449052”), but after the 449052 been killed, there is another new opid with the same error msg appears in shard03.

how can i clean this hang operation

my operation which cause the hang issue:

MongoDB Enterprise mongos> var session = db.getMongo().startSession()
MongoDB Enterprise mongos> session.startTransaction()
MongoDB Enterprise mongos> var tb1 = session.getDatabase('testdb01').getCollection('table01')
MongoDB Enterprise mongos> tb1.updateOne({id:1},{$set:{"id":"88888"}},{multi:false})

{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }

MongoDB Enterprise mongos> session.commitTransaction()
uncaught exception: Error: command failed: {
"ok" : 0,
"errmsg" : "Transaction was aborted :: caused by :: from shard rs_shard03 :: caused by :: 'prepareTransaction' is not supported for replica sets with arbiters",
"code" : 148,
"codeName" : "ReadConcernMajorityNotEnabled",
"$clusterTime" : {
"clusterTime" : Timestamp(1647248380, 3),
"signature" :

{ "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) }

},
"operationTime" : Timestamp(1647248380, 3),
"recoveryToken" :

{ "recoveryShardId" : "rs_shard03" }

} with original command request: {
"commitTransaction" : 1,
"txnNumber" : NumberLong(0),
"lsid" :

{ "id" : UUID("4baec96b-8124-4b4d-a3ac-c99a375ba7b0") }

,
"$clusterTime" : {
"clusterTime" : Timestamp(1647248371, 2),
"signature" :

{ "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) }

},
"autocommit" : false,
"stmtId" : NumberInt(1)
} on connection: connection to 127.0.0.1:32017 :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:18:14
_assertCommandWorked@src/mongo/shell/assert.js:737:17
assert.commandWorked@src/mongo/shell/assert.js:829:16
commitTransaction@src/mongo/shell/session.js:977:17
@(shell):1:1

currentOp() from shard03:

                        "type" : "op",
                        "host" : "redhat07:31018",
                        "desc" : "conn70",
                        "connectionId" : 70,
                        "client" : "192.168.17.160:49584",
                        "clientMetadata" : {
                                "driver" : {
                                        "name" : "NetworkInterfaceTL",
                                        "version" : "5.0.4"
                                },
                                "os" : {
                                        "type" : "Linux",
                                        "name" : "Red Hat Enterprise Linux release 8.2 (Ootpa)",
                                        "architecture" : "x86_64",
                                        "version" : "Kernel 4.18.0-193.el8.x86_64"
                                }
                        },
                        "active" : true,
                        "currentOpTime" : "2022-03-14T20:17:12.678+08:00",
                        "effectiveUsers" : [
                                {
                                        "user" : "__system",
                                        "db" : "local"
                                }
                        ],
                        "threaded" : true,
                        "opid" : 449052,
                        "secs_running" : NumberLong(579),
                        "microsecs_running" : NumberLong(579800192),
                        "op" : "command",
                        "ns" : "config.$cmd",
                        "command" : {
                                "createIndexes" : "system.sessions",
                                "v" : 2,
                                "indexes" : [
                                        {
                                                "key" : {
                                                        "lastUse" : 1
                                                },
                                                "name" : "lsidTTLIndex",
                                                "expireAfterSeconds" : 1800
                                        }
                                ],
                                "ignoreUnknownIndexOptions" : false,
                                "writeConcern" : {

                                },
                                "shardVersion" : [
                                        Timestamp(683, 0),
                                        ObjectId("621b2da8697e4a93cdda940a"),
                                        Timestamp(1645974391, 1520)
                                ],
                                "$clusterTime" : {
                                        "clusterTime" : Timestamp(1647259652, 1),
                                        "signature" : {
                                                "hash" : BinData(0,"Z5J1pKsgLOwJc9GbxekmhHc/DmE="),
                                                "keyId" : NumberLong("7069222986158440471")
                                        }
                                },
                                "$configTime" : Timestamp(1647259652, 1),
                                "$topologyTime" : Timestamp(0, 0),
                                "$configServerState" : {
                                        "opTime" : {
                                                "ts" : Timestamp(1647259652, 1),
                                                "t" : NumberLong(92)
                                        }
                                },
                                "$db" : "config"
                        },
                        "numYields" : 0,
                        "waitingForLatch" : {
                                "timestamp" : ISODate("2022-03-14T12:07:32.978Z"),
                                "captureName" : "AnonymousLockable"
                        },
                        "locks" : {

                        },
                        "waitingForLock" : false,
                        "lockStats" : {
                                "ParallelBatchWriterMode" : {
                                        "acquireCount" : {
                                                "r" : NumberLong(3)
                                        }
                                },
                                "ReplicationStateTransition" : {
                                        "acquireCount" : {
                                                "w" : NumberLong(3)
                                        }
                                },
                                "Global" : {
                                        "acquireCount" : {
                                                "r" : NumberLong(3)
                                        }
                                },
                                "Database" : {
                                        "acquireCount" : {
                                                "r" : NumberLong(3)
                                        }
                                },
                                "Collection" : {
                                        "acquireCount" : {
                                                "r" : NumberLong(3)
                                        }
                                },
                                "Mutex" : {
                                        "acquireCount" : {
                                                "r" : NumberLong(5)
                                        }
                                }
                        },
                        "waitingForFlowControl" : false,
                        "flowControlStats" : {

                        }
                },
                {
                        "client" : "",
                        "host" : "redhat07:31018",
                        "connectionId" : NumberLong(0),
                        "appName" : "",
                        "clientMetadata" : {

                        },
                        "desc" : "transaction coordinator",
                        "twoPhaseCommitCoordinator" : {
                                "lsid" : {
                                        "id" : UUID("4baec96b-8124-4b4d-a3ac-c99a375ba7b0"),
                                        "uid" : BinData(0,"O0CMtIVItQN4IsEOsJdrPL8s7jv5xwh5a/A5Qfvs2A8=")
                                },
                                "txnNumber" : NumberLong(0),
                                "numParticipants" : NumberLong(2),
                                "state" : "waitingForDecisionAck",
                                "commitStartTime" : ISODate("2022-03-14T11:50:03.174Z"),
                                "hasRecoveredFromFailover" : true,
                                "stepDurations" : {
                                        "writingParticipantListMicros" : NumberLong(22),
                                        "totalCommitDurationMicros" : NumberLong(1629492140),
                                        "waitingForVotesMicros" : NumberLong(1),
                                        "writingDecisionMicros" : NumberLong(2109),
                                        "waitingForDecisionAcksMicros" : NumberLong(1629490006)
                                },
                                "decision" : {
                                        "decision" : "abort",
                                        "abortStatus" : {
                                                "code" : 148,
                                                "codeName" : "ReadConcernMajorityNotEnabled",
                                                "errmsg" : "from shard rs_shard03 :: caused by :: 'prepareTransaction' is not supported for replica sets with arbiters"
                                        }
                                },
                                "deadline" : ISODate("2022-03-14T11:51:03.174Z")

the state of this hang operation is waitingForDecisionAck, how can i manual and force commit or abort it?

Hi @Yi_deng

Are you still seeing the abort operation in shard03 currently after waiting all this time?

What is your MongoDB version?

Best regards
Kevin

hi
kevin
thanks for your reply.
the version is 5.0.4 redhat 8.
i know the reason ,maybe: my shard have two members and one arbiter.
but i can not find the solution, so i drop all directory of mongod and mongos, i rebuild my cluster.
i have a question: if i have some business requirement whcih must update shard key, i should not config arbiter node in all shard replication sets?

i have configed a new cluster with no arbiter member, and i can update shard key successfully.
my operation:

MongoDB Enterprise mongos> var session = db.getMongo().startSession()
MongoDB Enterprise mongos> session.startTransaction()
MongoDB Enterprise mongos> var tb1 = session.getDatabase('testdb01').getCollection('table01')
MongoDB Enterprise mongos> tb1.find()
{ "_id" : ObjectId("62313fe8be512c6886208895"), "id" : 1, "name" : "user1" }
{ "_id" : ObjectId("62313fe8be512c6886208896"), "id" : 2, "name" : "user2" }
{ "_id" : ObjectId("62313fe8be512c6886208897"), "id" : 3, "name" : "user3" }
{ "_id" : ObjectId("62313fe8be512c6886208898"), "id" : 4, "name" : "user4" }
{ "_id" : ObjectId("62313fe8be512c6886208899"), "id" : 5, "name" : "user5" }
{ "_id" : ObjectId("62313fe8be512c688620889a"), "id" : 6, "name" : "user6" }
{ "_id" : ObjectId("62313fe8be512c688620889b"), "id" : 7, "name" : "user7" }
{ "_id" : ObjectId("62313fe8be512c688620889c"), "id" : 8, "name" : "user8" }
{ "_id" : ObjectId("62313fe8be512c688620889d"), "id" : 9, "name" : "user9" }
{ "_id" : ObjectId("62313fe8be512c688620889e"), "id" : 10, "name" : "user10" }
{ "_id" : ObjectId("62313fe8be512c688620889f"), "id" : 11, "name" : "user11" }
{ "_id" : ObjectId("62313fe8be512c68862088a0"), "id" : 12, "name" : "user12" }
{ "_id" : ObjectId("62313fe8be512c68862088a1"), "id" : 13, "name" : "user13" }
{ "_id" : ObjectId("62313fe8be512c68862088a2"), "id" : 14, "name" : "user14" }
{ "_id" : ObjectId("62313fe8be512c68862088a3"), "id" : 15, "name" : "user15" }
{ "_id" : ObjectId("62313fe8be512c68862088a4"), "id" : 16, "name" : "user16" }
{ "_id" : ObjectId("62313fe8be512c68862088a5"), "id" : 17, "name" : "user17" }
{ "_id" : ObjectId("62313fe8be512c68862088a6"), "id" : 18, "name" : "user18" }
{ "_id" : ObjectId("62313fe8be512c68862088a7"), "id" : 19, "name" : "user19" }
{ "_id" : ObjectId("62313fe8be512c68862088a8"), "id" : 20, "name" : "user20" }
Type "it" for more
MongoDB Enterprise mongos> tb1.updateOne({id:1},{$set:{"name":"gytyfyf"}},{multi:false})
{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }
MongoDB Enterprise mongos> session.commitTransaction()
MongoDB Enterprise mongos> db.table01.find({id:1})
{ "_id" : ObjectId("62313fe8be512c6886208895"), "id" : 1, "name" : "gytyfyf" }