[SERVER-622] element_.eoo assertion on invalid upsert Created: 10/Feb/10  Updated: 12/Jul/16  Resolved: 10/Feb/10

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

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

mongodb-linux-x86_64-1.3.1 (binary release) running on Linux 2.6.31-17-generic (Ubuntu 9.10), PHP 5.2.10-2ubuntu6.4


Participants:

 Description   

<?php
class Site {
  public $url;
  public $title;
}
 
$site = new Site();
 
$db = new MongoDB(new Mongo(), 'wotato');
 
// Inserts { "_id" : ObjectId(...), "title" : null, "url" : null }
$db->test->update(array('url' => 'http://example.com'), array('$set' => $site), array('upsert' => true));
 
$site->url = 'http://example.com';
 
// As update: Assertion error in database engine
// Expected: Successful update { "_id" : ObjectId(...), "url" : "http://example.com", "title" : null }
$db->test->update(array('url' => 'http://example.com'), array('$set' => $site), array('upsert' => true));
 
$db->dropCollection('test');
 
// As insert: Assertion error here too
// Expected: Successful insert { "_id" : ObjectId(...), "url" : "http://example.com", "title" : null }
$db->test->update(array('url' => 'http://example.com'), array('$set' => $site), array('upsert' => true));

Assertion (same for both operations):

Wed Feb 10 03:10:10  test.test Assertion failure !element_.eoo() db/jsobjmanipulator.h 32
0x4e8316 0x4f095f 0x550e9a 0x557b36 0x5597a3 0x5cbd7c 0x5ce1ca 0x647105 0x65f930 0x7f6fbc721a04 0x7f6fbbce080d
 ./mongod(_ZN5mongo12sayDbContextEPKc+0xe6) [0x4e8316]
 ./mongod(_ZN5mongo8assertedEPKcS1_j+0x13f) [0x4f095f]
 ./mongod(_ZNK5mongo6ModSet16applyModsInPlaceERKNS_7BSONObjE+0x34a) [0x550e9a]
 ./mongod(_ZN5mongo6ModSet18createNewFromQueryERKNS_7BSONObjE+0x676) [0x557b36]
 ./mongod(_ZN5mongo13updateObjectsEPKcNS_7BSONObjES2_bbbRNS_7OpDebugE+0x1893) [0x5597a3]
 ./mongod(_ZN5mongo14receivedUpdateERNS_7MessageERNS_5CurOpE+0x60c) [0x5cbd7c]
 ./mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERK11sockaddr_in+0xfaa) [0x5ce1ca]
 ./mongod(_ZN5mongo10connThreadEv+0x235) [0x647105]
 ./mongod(thread_proxy+0x80) [0x65f930]
 /lib/libpthread.so.0 [0x7f6fbc721a04]
 /lib/libc.so.6(clone+0x6d) [0x7f6fbbce080d]
Wed Feb 10 03:10:10 update test.test  query: { url: "http://example.com" } exception assertion db/jsobjmanipulator.h:32 1ms



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

see set5.js

Comment by auto [ 10/Feb/10 ]

Author:

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

Message: test for SERVER-622
http://github.com/mongodb/mongo/commit/38b822809b4ee78dc7721b49096b7b52761d155b

Comment by Kristina Chodorow (Inactive) [ 10/Feb/10 ]

This does seem to be a server bug, the equivalent JS code reproduces the assertion on the command line:

> db.foo.update(

{'url':'http://example.com'}

,{$set:{url:'http://example.com', 'title':null}}, true)
!element_.eoo()

Seems like ending the $set with a null messes things up.

Comment by Colin Snover [ 10/Feb/10 ]

Argh...can't edit description!

I am not sure that the upsert I am doing is actually invalid; I was just confused based on the response to SERVER-514.

Also, this is actually a SERVER issue, not PHP; I didn't think it was initially, but then I realized that the test I was doing on the command-line was not the same (I was omitting $set). Sorry!

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