[SERVER-54] spidermonkey may destroy connection before destroying cursor holding that connection, leading to "pure virtual method called" error Created: 18/May/09  Updated: 12/Jul/16  Resolved: 18/May/09

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

Type: Bug Priority: Minor - P4
Reporter: Aaron Staple Assignee: Aaron Staple
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

the following produces the described behavior:

t = db.jstests_capped4;
t.drop();

db.createCollection( "jstests_capped4",

{size:1000,capped:true}

);
t.ensureIndex(

{ i: 1 }

);
for( i = 0; i < 20; ++i ) {
t.save(

{ i : i }

);
}
c = t.find().sort(

{ $natural: -1 }

).limit( 2 );
c.next();

If I add more code to the end of this script the crash still occurs, but only as the shell is exiting.

After some investigation:
<http://www.nabble.com/Forcing-Complete-GC-Just-Before-Destroying-a-Context-td22879892.html>
> A few key realizations:
> - JSNatives never run when Finalizers run (helps to know if you care about
> thread safety)
> - Finalization happens in any order
> - References between unreachable objects are irrelvant (closer to
> Java-style GC rather than Cedar or Modula-3)
> - SpiderMonkey GC is not incremental (it always collects everything it can)

Let me know if you want me to fix, Eliot.



 Comments   
Comment by Aaron Staple [ 18/May/09 ]

Ok, I fixed this – just added reference counted pointers in sm code, since using smart pointers w/ dbclient code more generally proved to be too much work & not necessarily useful with current code.

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