我们正在使用 MongoDB (v2.6.4) 来处理一些数据,一切都很好,除了偶尔,我们会遇到一个奇怪的 RUNNER_DEAD 异常...
MongoDB.Driver.WriteConcernException: WriteConcern detected an error ' Update query failed -- RUNNER_DEAD'. (Response was { "lastOp" : { "$timestamp" : NumberLong("6073471510486450182") }, "connectionId" : 49, "err" : " Update query failed -- RUNNER_DEAD", "code" : 1, "n" : 0, "ok" : 1.0 }).
这是导致异常的方法:
private void UpdateEntityClassName(EntityClassName myEntity) {
var dateTimeNow = DateTime.UtcNow;
var update = Update<EntityClassName>.Set(p => p.Data, myEntity.Data)
...some more Sets...
.Set(p => p.MetaData.LastModifiedDateTime, dateTimeNow);
var result = _myCollection.Update(Query.EQ("_id", myEntity.Identifier), update, UpdateFlags.Upsert);
}
MongoDB 日志异常:
2014-10-23T13:51:29.989-0500 [conn45] update Database.Table query: { _id: "SameID" } update: { $set: { Data: BinData(0, SomeData...), ...more fields... MetaData.LastModifiedDateTime: new Date(1414090294910) } } nmoved:1 nMatched:1 nModified:1 keyUpdates:0 numYields:0 locks(micros) w:2344 2ms
2014-10-23T13:51:29.989-0500 [conn49] User Assertion: 1: Update query failed -- RUNNER_DEAD
2014-10-23T13:51:29.989-0500 [conn46] update Database.Table query: { _id: "SameID" } update: { $set: { Data: BinData(0, SomeData...), ...more fields... MetaData.LastModifiedDateTime: new Date(1414090294926) } } nMatched:1 nModified:1 fastmod:1 keyUpdates:0 numYields:0 locks(micros) w:249 0ms
2014-10-23T13:51:29.989-0500 [conn49] update Database.Table query: { _id: "SameID" } update: { $set: { Data: BinData(0, SomeData...), ...more fields... MetaData.LastModifiedDateTime: new Date(1414090294864) } } nModified:0 keyUpdates:0 exception: Update query failed -- RUNNER_DEAD code:1 numYields:1 locks(micros) w:285 8ms
我发现关于此异常的文档非常少,因此非常感谢任何帮助。
如果有任何变化,我们将在 3 台机器的副本集中运行它。
我们已经运行这段代码一段时间了,之前(在我们最初的测试中)我们没有遇到过这个问题,所以我们回到了 MongoDB 2.4.9(我们第一次测试的那个),但我们没有得到这个异常(exception)了。关于可能导致此异常的更改的任何想法?
最佳答案
Why you couldn't use a regular "update" using capped arrays to limit the size of the array of queries rather than using some custom logic).
If you have multiple threads that are doing the same thing, your code doesn't appear thread-safe - let's say that two threads try to update the same object with _id XYZ but with different changes. Both fetch the object, both add a new attribute/value to the array and now both call save - the first one saves, but the second one's save overwrites the first one.
But that's not likely to be related to your error with
RUNNER_DEAD
error - that's more likely a case where either something is killing the operation or dropping the collection you're writing to (or the index being used).
来源:@Asya Kamsky's post .
关于mongodb - 用户断言 : 1: Update query failed -- RUNNER_DEAD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26537039/