Permalink
Browse files

- SERVER-1900: v8 seems to be fixed. Reenabled both tests and it's pa…

…ssing now.
  • Loading branch information...
1 parent 2ebc3ba commit cade80c5d168253242127e35730d76874d0ee7ed @agirbal agirbal committed Oct 6, 2011
Showing with 19 additions and 15 deletions.
  1. +13 −12 jstests/evalf.js
  2. +2 −2 jstests/killop.js
  3. +4 −1 scripting/v8_db.cpp
View
@@ -3,24 +3,25 @@
t = db.jstests_evalf;
t.drop();
-if ( typeof _threadInject == "undefined" ) { // don't run in v8 mode - SERVER-1900
+//if ( typeof _threadInject == "undefined" ) { // don't run in v8 mode - SERVER-1900
+// the code in eval must be under 512 chars because otherwise it's not displayed in curOp()
+try {
db.eval( function() {
opid = null;
while( opid == null ) {
ops = db.currentOp().inprog;
for( i in ops ) {
o = ops[ i ];
- if ( o.active && o.query && o.query.$eval ) {
- opid = o.opid;
- }
- }
- }
- db.jstests_evalf.save( {opid:opid} );
- db.jstests_evalf.count( { $where:function() {
- db.killOp( db.jstests_evalf.findOne().opid );
- while( 1 ) { ; }
- } } );
+ if ( o.active && o.query && o.query.$eval ) { opid = o.opid; }
+ }}
+ db.jstests_evalf.save( {"opid":opid} );
+ db.jstests_evalf.count( { $where:function() { var id = db.jstests_evalf.findOne().opid; db.killOp( id ); while( 1 ) { ; } } } );
} );
+} catch (ex) {
+ // exception is thrown in V8 when job gets killed. Does not seem like bad behavior.
+}
-}
+// make sure server and JS still work
+db.eval( function() { db.jstests_evalf.count(); });
+//}
View
@@ -1,7 +1,7 @@
t = db.jstests_killop
t.drop();
-if ( typeof _threadInject == "undefined" ) { // don't run in v8 mode - SERVER-1900
+//if ( typeof _threadInject == "undefined" ) { // don't run in v8 mode - SERVER-1900
function debug( x ) {
// printjson( x );
@@ -40,4 +40,4 @@ s2();
// don't want to pass if timeout killed the js function
assert( ( new Date() ) - start < 30000 );
-}
+//}
View
@@ -329,7 +329,10 @@ namespace mongo {
return v8::ThrowException( v8::String::New( "error doing query: failed" ) );
}
v8::Function * cons = (v8::Function*)( *( mongo->Get( scope->getV8Str( "internalCursor" ) ) ) );
- assert( cons );
+ if ( !cons ) {
+ // may get here in case of thread termination
+ return v8::ThrowException( v8::String::New( "Could not create a cursor" ) );
+ }
Persistent<v8::Object> c = Persistent<v8::Object>::New( cons->NewInstance() );
c.MakeWeak( cursor.get() , destroyCursor );

0 comments on commit cade80c

Please sign in to comment.