[SERVER-1020] Assertion: 13000:invalid keyNode Created: 14/Apr/10  Updated: 12/Jul/16  Resolved: 17/May/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.4.0
Fix Version/s: 1.5.2

Type: Bug Priority: Major - P3
Reporter: Okku Touronen Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

WIndows 2003 server 32-bit


Attachments: File db.rar    
Participants:

 Description   

I am looping through all artists in the db and issuing following three queries for each:

  • Update img in artist by id
    db.artists.update( { _id: "sSKwjm_S1go" }

    ,

    Unknown macro: { $set}

    )

  • Update all simarts.img for all artists
    db.artists.update( { simarts.id: "sSKwjm_S1go" }

    ,

    Unknown macro: { $set}

    )

  • Update all tagart img by artistId
    update cl.tagarts query: { artistid: "sSKwjm_S1go" }

    update:

    Unknown macro: { $set}

    db.tagarts.update(

    { artistid: "sSKwjm_S1go" }

    ,

    Unknown macro: { $set}

    )
    THIS IS THE QUERY WHICH FAILS SOMETIMES

Get this exceptions in the log when i am updating, example log:

update cl.artists query:

{ _id: "sSKwjm_S1go" }

update: { $set:

{ img: "D1FD71F8B062F0C8" }

} 0ms
update cl.artists query:

{ simarts.id: "sSKwjm_S1go" }

update: { $set:

{ simarts.$.img: "D1FD71F8B062F0C8" }

} 31ms
Assertion: 13000:invalid keyNode:

{ "i" : 100, "n" : 100 }


Caught Assertion in update , continuing
update cl.tagarts query:

{ artistid: "sSKwjm_S1go" }

update: { $set:

{ image: "D1FD71F8B062F0C8" }

} exception massert:invalid keyNode:

{ "i" : 100, "n" : 100 }

15ms
update cl.artists query:

{ _id: "Nd4OdVNHflU" }

update: { $set:

{ img: "E2CD326B2E47EF56" }

} 0ms
update cl.artists query:

{ simarts.id: "Nd4OdVNHflU" }

update: { $set:

{ simarts.$.img: "E2CD326B2E47EF56" }

} 31ms
update cl.tagarts query:

{ artistid: "Nd4OdVNHflU" }

update: { $set:

{ image: "E2CD326B2E47EF56" }

} 0ms
update cl.artists query:

{ _id: "jeX7zu5fEYE" }

update: { $set:

{ img: "3F8264975F62116C" }

} 0ms
update cl.artists query:

{ simarts.id: "jeX7zu5fEYE" }

update: { $set:

{ simarts.$.img: "3F8264975F62116C" }

} 31ms
update cl.tagarts query:

{ artistid: "jeX7zu5fEYE" }

update: { $set:

{ image: "3F8264975F62116C" }

} 0ms
update cl.artists query:

{ _id: "JsSAZfOn7NA" }

update: { $set:

{ img: "61EE3041543A7F18" }

} 0ms
update cl.artists query:

{ simarts.id: "JsSAZfOn7NA" }

update: { $set:

{ simarts.$.img: "61EE3041543A7F18" }

} 15ms
Assertion: 13000:invalid keyNode:

{ "i" : 96, "n" : 96 }


Caught Assertion in update , continuing
update cl.tagarts query:

{ artistid: "JsSAZfOn7NA" }

update: { $set:

{ image: "61EE3041543A7F18" }

} exception massert:invalid keyNode:

{ "i" : 96, "n" : 96 }

0ms
update cl.artists query:

{ _id: "fcdNwrJjCLw" }

update: { $set:

{ img: "2E68C6FF30CCD6B9" }

} 0ms
update cl.artists query:

{ simarts.id: "fcdNwrJjCLw" }

update: { $set:

{ simarts.$.img: "2E68C6FF30CCD6B9" }

} 31ms
Assertion: 13000:invalid keyNode:

{ "i" : 100, "n" : 100 }


Caught Assertion in update , continuing
update cl.tagarts query:

{ artistid: "fcdNwrJjCLw" }

update: { $set:

{ image: "2E68C6FF30CCD6B9" }

} exception massert:invalid keyNode:

{ "i" : 100, "n" : 100 }

0ms



 Comments   
Comment by Eliot Horowitz (Inactive) [ 19/May/10 ]

I think this issue SERVER-1060 is very similar and will go out with 1.4.3.
I think there is a high probability that will fix your problem.

Comment by Jeremy G. Kahn [ 18/May/10 ]

I am having the same problem – or a very similar one – on 1.4.1 mongo on OS-X 64-bit.

Is there any workaround besides building the post-bleeding edge 1.5.2?

Comment by auto [ 17/May/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: fix for yield on multi-updatre SERVER-1020
http://github.com/mongodb/mongo/commit/016af45e0b5cbe1711906fb75002031b0b573183

Comment by Okku Touronen [ 14/May/10 ]

I created this simple script to replicate the problem, since this is really annoying for me I would like to know if this can be reproduced by someone else and what the status is.

Create some data:
> for(i=0;i<1000;i++){ db.t2.insert({_id:i,k:i%12,v:"v"+i%12}); }

Add index for k:
> db.t2.ensureIndex(

{k:1}

)

Update v for all k=2:
> db.t2.update(

{k:2}

,{$set:{v:"two v2"}},false,true)
invalid keyNode:

{ "i" : 207, "n" : 207 }

Execute some counts:
> db.t2.count(

{k:2,v:"v2"}

)
45
> db.t2.count(

{k:2,v:"two v2"}

)
39

Remove index:
db.t2.dropIndexes();

Update v for all k=2:
> db.t2.update(

{k:2}

,{$set:{v:"three v2"}},false,true)

Execute some counts:
> db.t2.count(

{k:2,v:"v2"}

)
0
> db.t2.count(

{k:2,v:"three v2"}

)
84

Comment by Okku Touronen [ 14/Apr/10 ]

If I remove the index

{artistid:1}

then everything works.

If I add the index again then I get the same strange behavior.

This has clearly something to do with indexes on non ids and multi updates using that index.

Comment by Okku Touronen [ 14/Apr/10 ]

Argh!
I was a little to quick to say that this didn't happen on 64-bit, I have run the script again and have exactly the same problem. And I have isolated it to one simple update query. By just issuing following statement in the consle:

>db.tagarts.update(

{artistid:"yp6S4OY9ryc"}

,{$set:{image:"AF429D812D0755D9"}},false,true)
invalid keyNode:

{ "i" : 171, "n" : 171 }

It seems to update some of the objects but not all. If I repeat the update command 4-5 times it eventually updates all objects and everything seems ok again, I get no errors even if I repeat the command 10 times after that.

I notice that I have forgotten to include the update all flags in the initial description above.

Comment by Okku Touronen [ 14/Apr/10 ]

The symptoms for me on both my 32bit dev machine and the server also 32bit is that not all objects was updated correctly after i run the script. I never found any assertions messages in the log in my 32bit dev machine, but I didn't go through the entire log either. But if I run the script 4-5 times eventually all objects was updated.

I can reproduce the assertions on my server.

I tried to make a simple more isolated script but it didn't trig the bug.

Sorry if I can't be more exact.

If you really need help with this I can put some more time into it.

We will go 64bit on the server and hopefully avoid the bug.

Comment by Eliot Horowitz (Inactive) [ 14/Apr/10 ]

I have been unable to reproduce on linux.
Can you confirm this is reproducable on win32?

Comment by Okku Touronen [ 14/Apr/10 ]

I have tried my scripts on a modern dev machine (windows 7 64bit) and on this machine I can't reproduce the errors. Maybe this is a windows 32-bit only error?

Generated at Thu Feb 08 02:55:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.