[JAVA-629] Corrupted mongo records getting inserted Created: 27/Aug/12  Updated: 25/Jun/13  Resolved: 11/Sep/12

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Paramita Ghosh Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: bson, driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Unix


Issue Links:
Related

 Description   

Mongo records are getting created of type BSON 101. While trying to read the record using ruby gem it fails with the following error

"No c decoder for this type yet(101)"

Mongo validate provide the following info

Mon Aug 27 12:09:19 [conn1] Invalid bson detected in apiPerf.apiResponseData with _id: "<id>"
Mon Aug 27 12:09:19 [conn1] Invalid bson detected in apiPerf.apiResponseData with _id: "<id>"
Mon Aug 27 12:09:19 [conn1] command apiPerf.$cmd command: { validate: "apiResponseData", full: true } ntoreturn:1 reslen:1424 117ms



 Comments   
Comment by Jeffrey Yemin [ 11/Sep/12 ]

It turns out this happens when you try to use a string with embedded nulls as a key inside an embedded object.

Comment by Paramita Ghosh [ 07/Sep/12 ]

This issue is consistent when I try to insert a MultivaluedMap<String, String> in the mongo. I have tried with mongo 2.2 as well with same results. Could you please provide any insight on this.

Comment by Jeffrey Yemin [ 05/Sep/12 ]

Paramita,

Sorry to take so long to get back to you. Though you are using the Java driver, it's not clear that anything in the driver itself is causing corruption on the server. Are you able to reliably reproduce this error, and if so, can you provide us source that we can run ourselves?

Comment by Paramita Ghosh [ 27/Aug/12 ]

The code which inserts the records

create(Map<String, Object> body, Map<String, Object> metaData, String collectionName)

{ metaData = new HashMap<String, Object>(); //entity is a wrapper object to hold the body and metadata along with id <Spring Mongo Template>.insert(entity, collectionName); }
Comment by Paramita Ghosh [ 27/Aug/12 ]

Here is the output from validate(True)
Mon Aug 27 13:36:06 [conn2] CMD: validate apiPerf.apiResponseData
Mon Aug 27 13:36:06 [conn2] Assertion: 10334:Invalid BSONObj size: 1744961536 (0x00000268) first element: llo: ?type=101
0x10008684d 0x10000b20d 0x10000b5f0 0x100019e9f 0x100019ea7 0x100019ea7 0x100508d8c 0x10050dd51 0x1004e9c47 0x1004eb0d7 0x1004aa954 0x1004ac089 0x1003e8e7f 0x1003ebd1a 0x10060e234 0x10014be52 0x100616f84 0x7fff8ba218bf 0x7fff8ba24b75
0 mongod 0x000000010008684d _ZN5mongo11msgassertedEiPKc + 333
1 mongod 0x000000010000b20d _ZNK5mongo7BSONObj14_assertInvalidEv + 1101
2 mongod 0x000000010000b5f0 _ZNK5mongo11BSONElement14embeddedObjectEv + 160
3 mongod 0x0000000100019e9f _ZNK5mongo7BSONObj5validEv + 447
4 mongod 0x0000000100019ea7 _ZNK5mongo7BSONObj5validEv + 455
5 mongod 0x0000000100019ea7 _ZNK5mongo7BSONObj5validEv + 455
6 mongod 0x0000000100508d8c _ZN5mongo11ValidateCmd10validateNSEPKcPNS_16NamespaceDetailsERKNS_7BSONObjERNS_14BSONObjBuilderE + 4732
7 mongod 0x000000010050dd51 _ZN5mongo11ValidateCmd3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 401
8 mongod 0x00000001004e9c47 _ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 2343
9 mongod 0x00000001004eb0d7 _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 2615
10 mongod 0x00000001004aa954 _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 52
11 mongod 0x00000001004ac089 ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1 + 5081
12 mongod 0x00000001003e8e7f _ZN5mongo13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 623
13 mongod 0x00000001003ebd1a _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1402
14 mongod 0x000000010060e234 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 148
15 mongod 0x000000010014be52 _ZN5mongo3pms9threadRunEPNS_13MessagingPortE + 754
16 mongod 0x0000000100616f84 thread_proxy + 132
17 libsystem_c.dylib 0x00007fff8ba218bf _pthread_start + 335
18 libsystem_c.dylib 0x00007fff8ba24b75 thread_start + 13
Mon Aug 27 13:36:06 [conn2] Invalid bson detected in apiPerf.apiResponseData with _id: <id>

Comment by Scott Hernandez (Inactive) [ 27/Aug/12 ]

Can you provide the output from your validate(true) as well as the sample code which inserted this bad data?

Comment by Paramita Ghosh [ 27/Aug/12 ]

This issue is happening when we are trying to insert record from java code i.e the records are getting corrupted. And when I run the mongo db validate method on the collection in question, I receive the mentioned log. Since the record is getting corrupted(as per mongo validate) during the insert from java code I do not think this is a issue with ruby.

The server version : 2.0.6
To insert record in mongo we are using : org.springframework.data.mongodb.core.MongoTemplate

Comment by Scott Hernandez (Inactive) [ 27/Aug/12 ]

This doesn't sounds like a java exception nor error message. Did you mean to put this in the server project, or maybe ruby?

How did you get this data into the database? What version is the server?

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