[SERVER-12068] Exception generated from update for 2d index, $near update Created: 12/Dec/13  Updated: 27/Jan/14  Resolved: 23/Jan/14

Status: Closed
Project: Core Server
Component/s: Geo, Index Maintenance
Affects Version/s: 2.4.6, 2.5.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jonathan Abrahams Assignee: Benety Goh
Resolution: Cannot Reproduce Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Observed in standalone environment on Mac OS, but seems to be generic


Attachments: File server12068.js    
Issue Links:
Related
related to SERVER-12120 geo $near deduping is not working Closed
Operating System: ALL
Steps To Reproduce:

var t = db.jstests_geo_deduplication;

// 2d index with $near
t.drop();
t.ensureIndex(

{locs: "2d"}

);
t.save(

{locs: [[49.999,49.999], [50.0,50.0], [50.001,50.001]]}

);

t.update({locs: {$near: [50.0, 50.0]}}, {$inc: {touchCount: 1}}, false, true);
assert.eq(1, db.getLastErrorObj().n);
e

Participants:

 Description   

Found in QA-322, update_geo_dedup.js

The behavior exists in 2.4.6 as follows:

  • Assertion in mongod
    Thu Dec 12 11:43:48.215 [conn1] Assertion: 10334:BSONObj size: -286331154 (0xEEEEEEEE) is invalid. Size must be between 0 and 16793600(16MB) First element: _id: ObjectId('52a9e7a29013d3eba0228d38')
    0x10044ac7b 0x1004246ce 0x10042478d 0x10007e6d7 0x1003b6a2c 0x100246982 0x10024861f 0x1001eaf9b 0x1001ee3e1 0x10000b9a2 0x100440669 0x10047d815 0x7fff9435e772 0x7fff9434b1a1
    0 mongod 0x000000010044ac7b _ZN5mongo15printStackTraceERSo + 43
    1 mongod 0x00000001004246ce _ZN5mongo11msgassertedEiPKc + 174
    2 mongod 0x000000010042478d _ZN5mongo11msgassertedEiRKSs + 29
    3 mongod 0x000000010007e6d7 _ZNK5mongo7BSONObj14_assertInvalidEv + 1255
    4 mongod 0x00000001003b6a2c _ZN5mongo7BSONObjC1EPKc + 44
    5 mongod 0x0000000100246982 _ZN5mongo14_updateObjectsEbPKcRKNS_7BSONObjES4_bbbRNS_7OpDebugEPNS_11RemoveSaverEbRKNS_24QueryPlanSelectionPolicyEb + 6626
    6 mongod 0x000000010024861f _ZN5mongo13updateObjectsEPKcRKNS_7BSONObjES4_bbbRNS_7OpDebugEbRKNS_24QueryPlanSelectionPolicyE + 127
    7 mongod 0x00000001001eaf9b _ZN5mongo14receivedUpdateERNS_7MessageERNS_5CurOpE + 1643
    8 mongod 0x00000001001ee3e1 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 6193
    9 mongod 0x000000010000b9a2 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 198
    10 mongod 0x0000000100440669 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 1657
    11 mongod 0x000000010047d815 thread_proxy + 229
    12 libsystem_c.dylib 0x00007fff9435e772 _pthread_start + 327
    13 libsystem_c.dylib 0x00007fff9434b1a1 thread_start + 13
    Thu Dec 12 11:43:48.245 [conn1] update test.jstests_geo_deduplication query:
    Unknown macro: { locs}

    update:

    Unknown macro: { $inc}

    nscanned:2 nmoved:1 keyUpdates:0 exception: BSONObj size: -286331154 (0xEEEEEEEE) is invalid. Size must be between 0 and 16793600(16MB) First element: _id: ObjectId('52a9e7a29013d3eba0228d38') code:10334 locks(micros) w:36357 36ms

Mongo shell (client) sees the following:
> t.update({locs: {$near: [50.0, 50.0]}}, {$inc: {touchCount: 1}}, false, true);
> db.getLastErrorObj()

{ "n" : 0, "connectionId" : 1, "err" : null, "ok" : 1 }

> t.find()

{ "_id" : ObjectId("52a9e7a29013d3eba0228d38"), "locs" : [ [ 49.999, 49.999 ], [ 50, 50 ], [ 50.001, 50.001 ] ], "touchCount" : 1 }

In 2.5.4 the behavior is similar but the error is propagated back to the user:

> t.update({locs: {$near: [50.0, 50.0]}}, {$inc: {touchCount: 1}}, false, true);
Update WriteResult(

{ "errmsg" : "exception: BSONObj size: -286331154 (0xEEEEEEEE) is invalid. Size must be between 0 and 16793600(16MB) First element: locs: [ [ 49.999, 49.999 ], [ 50.0, 50.0 ], [ 50.001, 50.001 ] ]", "code" : 10334, "ok" : 0 }) > db.getLastErrorObj() { "err" : "BSONObj size: -286331154 (0xEEEEEEEE) is invalid. Size must be between 0 and 16793600(16MB) First element: locs: [ [ 49.999, 49.999 ], [ 50.0, 50.0 ], [ 50.001, 50.001 ] ]", "code" : 10334, "n" : 0, "connectionId" : 10, "ok" : 1 } > t.find() { "_id" : ObjectId("52a9e69d7710093746faf850"), "locs" : [ [ 49.999, 49.999 ], [ 50, 50 ], [ 50.001, 50.001 ] ], "touchCount" : 1 }

 Comments   
Comment by Jonathan Abrahams [ 27/Jan/14 ]

Verified in "gitVersion" : "c51857a44af6fc69f1e21bb9c6b2b6adda0ef80e"

Comment by Jonathan Abrahams [ 27/Jan/14 ]

Latest nightly no longer has this issue:

"version" : "2.5.5-pre-",
"gitVersion" : "c51857a44af6fc69f1e21bb9c6b2b6adda0ef80e",
"OpenSSLVersion" : "",
"sysInfo" : "Darwin bs-osx-108-x86-64-2.10gen.cc 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",

Comment by Benety Goh [ 21/Jan/14 ]

jonathan.abrahams, I tried this on 2.5.5-pre (git version: df45324b26d66f8a5155a0a9799b0ba000544ebb) with the attached js test script and it passed for me. Can we resolve this?

Comment by Daniel Pasette (Inactive) [ 03/Jan/14 ]

I think this is a duplicate or related to SERVER-12120.

Comment by Jonathan Abrahams [ 19/Dec/13 ]

Reproduced it from fresh build: 2.5.5-pre- (git version: c2f072309bf3d5e64757ebf49d98c005f3c47498) (modules: subscription)

> var t = db.jstests_geo_deduplication;
> t.drop();
true
> t.ensureIndex(

{locs: "2d"}

);
> t.save(

{locs: [[49.999,49.999], [50.0,50.0], [50.001,50.001]]}

);
Insert WriteResult({ "ok" : 1, "nDocsModified" : 0, "n" : 1, "writeConcernError" : { } })
> t.update({locs: {$near: [50.0, 50.0]}}, {$inc: {touchCount: 1}}, false, true);
Update WriteResult({
"ok" : 1,
"nDocsModified" : 0,
"n" : 0,
"writeErrors" : [

{ "index" : 0, "code" : 1, "errmsg" : " Update query failed -- RUNNER_ERROR" }

]
})

Comment by Daniel Pasette (Inactive) [ 19/Dec/13 ]

I cannot reproduce this on 2.5.5-pre (git version: 22a03afae8a1a3b9e9218e8e9985f5bfb8d9ac04)

Generated at Thu Feb 08 03:27:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.