diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-08-21 16:15:36 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-08-21 16:15:36 -0400 |
commit | 1e1977a6989a0b45446cd75dd874eeacc4acefcb (patch) | |
tree | d3c3e4c2a222cc0a9656d2b5c9c4e463f140c971 | |
parent | 33ac3c31c302b8cb04bd54232bb9f9f6565a1ca7 (diff) | |
download | mongo-1e1977a6989a0b45446cd75dd874eeacc4acefcb.tar.gz |
fix concurrency issue cleaning up pooled scopes
-rw-r--r-- | scripting/engine.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripting/engine.cpp b/scripting/engine.cpp index 132793743b9..06efee0d4e6 100644 --- a/scripting/engine.cpp +++ b/scripting/engine.cpp @@ -124,9 +124,15 @@ namespace mongo { PooledScope( const string pool , Scope * real ) : _pool( pool ) , _real( real ){}; virtual ~PooledScope(){ ScopeCache * sc = scopeCache.get(); - assert( sc ); - sc->done( _pool , _real ); - _real = 0; + if ( sc ){ + sc->done( _pool , _real ); + _real = 0; + } + else { + log() << "warning: scopeCache is empty!" << endl; + delete _real; + _real = 0; + } } void reset(){ |