[SERVER-3737] v8 BinData corruption Created: 31/Aug/11  Updated: 11/Jul/16  Resolved: 26/Sep/11

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: 1.8.0-rc0, 1.8.0-rc1, 1.8.0-rc2, 1.8.0, 1.8.1, 1.8.2, 1.8.3, 1.9.0, 1.9.1, 1.9.2, 2.0.0-rc0
Fix Version/s: 2.1.0

Type: Bug Priority: Minor - P4
Reporter: Jason Volk Assignee: Antoine Girbal
Resolution: Done Votes: 1
Labels: insert
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux cdc 3.0.0-cdc-07647-g250f8e3 #13 SMP Sun Jul 31 12:35:55 EDT 2011 x86_64 GNU/Linux
AMD64


Operating System: ALL
Participants:

 Description   

Trying to insert the sha1 hash of 7800000000000000000000000000000000000000

mongos> foo = new BinData(0,"eAAAAAAAAAAAAAAAAAAAAAAAAAA=")
BinData(0,"eAAAAAAAAAAAAAAAAAAAAAAAAAA=")
mongos> db.dhts.insert({_id:foo})
mongos> db.dhts.find()

{ "_id" : BinData(0,"eAAAAAAAAAAAAAAAAAAAAAAAAAA=") }
    1. All good so far.
    2. Now trying to insert the sha1 hash of 8000000000000000000000000000000000000000

mongos> foo = new BinData(0,"gAAAAAAAAAAAAAAAAAAAAAAAAAA=")
BinData(0,"gAAAAAAAAAAAAAAAAAAAAAAAAAA=")
mongos> db.dhts.insert({_id:foo})
mongos> db.dhts.find()

{ "_id" : BinData(0,"eAAAAAAAAAAAAAAAAAAAAAAAAAA=") } { "_id" : BinData(0,"77+9AAAAAAAAAAAAAAAAAAAAAAA=") }
    1. Insertion has corrupted data.
    1. This is additionally present directly in the C++ driver
      obj.appendBinData("_id",20,BinDataGeneral,hash0);
      obj.appendBinData("_id",20,BinDataGeneral,hash1);
    1. Where hash0 is <80... and hash1 is >=80...


 Comments   
Comment by Antoine Girbal [ 26/Sep/11 ]

this was resolved with SERVER-3168

Comment by Antoine Girbal [ 14/Sep/11 ]

I cannot reproduce with a 2.0 build, this was most likely fixed when I took care of BinData's new methods.
In v8 build:
foo:PRIMARY> foo = new BinData(0,"gAAAAAAAAAAAAAAAAAAAAAAAAAA=")
BinData(0,"gAAAAAAAAAAAAAAAAAAAAAAAAAA=")
foo:PRIMARY> db.test.insert(

{a: foo}

)
foo:PRIMARY> db.test.find()

{ "_id" : ObjectId("4e7120db098c3e1cb12ff351"), "a" : BinData(0,"gAAAAAAAAAAAAAAAAAAAAAAAAAA=") }
Comment by Jason Volk [ 10/Sep/11 ]

Eliot: Recompiled without --usev8 (I'm guessing that's spidermonkey by default) (and also at BUMP 2.0.0-rc2 c395a51 for reference) and all behavior is normal. Bug doesn't show up.

Comment by Eliot Horowitz (Inactive) [ 10/Sep/11 ]

v8 isn't fully supported or working yet - so that might be the issue.
can you try with spidermonkey

Comment by Jason Volk [ 10/Sep/11 ]

If this is related to javascript, I should add that I'm using v8 (2011-08-22: Version 3.5.7 | svn r8981)

galam yum: Are you using v8 or spidermonkey?

Comment by galam yum [ 09/Sep/11 ]

Hi

I ran the insert test...it worked fine on my machine

os: win7 x64

mongodb version 1.8.3

Comment by Jason Volk [ 05/Sep/11 ]

Some more info:
This is additionally present when I mapreduce with binary fields {_id: BinData()} etc...

Also this corruption:

mongos> bam = new HexData(0,"b000000000000000000000000000000000000000")
{
"len" : 20,
"type" : 0,
"toString" : function () { [native code] },
"base64" : function () { [native code] },
"hex" : function () { [native code] }
}
mongos> bam
{
"len" : 20,
"type" : 0,
"toString" : function () { [native code] },
"base64" : function () { [native code] },
"hex" : function () { [native code] }
}
mongos> bam.hex()
b0000000000000000000000000000000a8000038

Comment by Jason Volk [ 05/Sep/11 ]

Trying to insert the sha1 hash of 7800000000000000000000000000000000000000

mongos> foo = new BinData(0,"eAAAAAAAAAAAAAAAAAAAAAAAAAA=")
BinData(0,"eAAAAAAAAAAAAAAAAAAAAAAAAAA=")
mongos> db.dhts.insert({_id:foo})
mongos> db.dhts.find()

{ "_id" : BinData(0,"eAAAAAAAAAAAAAAAAAAAAAAAAAA=") }

All good so far.

Now trying to insert the sha1 hash of 8000000000000000000000000000000000000000

mongos> foo = new BinData(0,"gAAAAAAAAAAAAAAAAAAAAAAAAAA=")
BinData(0,"gAAAAAAAAAAAAAAAAAAAAAAAAAA=")
mongos> db.dhts.insert({_id:foo})
mongos> db.dhts.find()

{ "_id" : BinData(0,"eAAAAAAAAAAAAAAAAAAAAAAAAAA=") }
{ "_id" : BinData(0,"77+9AAAAAAAAAAAAAAAAAAAAAAA=") }

Insertion has corrupted data.

This is additionally present directly in the C++ driver

obj.appendBinData("_id",20,BinDataGeneral,hash0);
obj.appendBinData("_id",20,BinDataGeneral,hash1);

Where hash0 is <80... and hash1 is >=80...

Comment by Jason Volk [ 01/Sep/11 ]

I apologize for the formatting. If there is a way to edit the original issue I can do so for the record.

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