[SERVER-13303] Crash during garbage collection Created: 21/Mar/14  Updated: 10/Dec/14  Resolved: 15/May/14

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

Type: Bug Priority: Critical - P2
Reporter: Andrew Poland [X] Assignee: Mathias Stearn
Resolution: Duplicate Votes: 0
Labels: crash
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File WatchlistProcessing.js     File v8-2.4.patch     File v8-2.6.patch    
Issue Links:
Duplicate
duplicates SERVER-13798 v8 garbage collection can cause crash... Closed
Operating System: ALL
Participants:

 Description   

When running serverside javascript with logging after running anywhere between 20 minutes to 2 hours mongo crashes and logs a stack trace as shown in table below.

The function does a number of queries and inserts. The logging appears to indicate that it is thrown just before an add. The time it takes for this to occur seems to decrease if logging is added to the function. Where logging is performed with print and printjson.

Date ConnectionNumber Executable file function
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\mongo\util\stacktrace.cpp(167) mongo::printStackTrace+0x3e
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\mongo\db\db.cpp(1488) mongo::myPurecallHandler+0x9
Fri Mar 21 02:21:02.835 [conn7] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\purevirt.c(54) _purecall+0x18
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\mongo\client\dbclientcursor.cpp(350) mongo::DBClientCursor::~DBClientCursor+0x140
Fri Mar 21 02:21:02.835 [conn7] mongod.exe   mongo::DBClientCursor::`scalar deleting destructor'+0x14
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\mongo\scripting\engine_v8.h(108) mongo::ObjTracker<mongo::DBClientCursor>::deleteOnCollect+0x32
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\third_party\v8\src\global-handles.cc(233) v8::internal::GlobalHandles::Node::PostGarbageCollectionProcessing+0x96
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\third_party\v8\src\global-handles.cc(558) v8::internal::GlobalHandles::PostGarbageCollectionProcessing+0xc9
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\third_party\v8\src\heap.cc(923) v8::internal::Heap::PerformGarbageCollection+0x5d4
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\third_party\v8\src\heap.cc(588) v8::internal::Heap::CollectGarbage+0x18c
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\third_party\v8\src\factory.cc(515) v8::internal::Factory::CopyFixedArray+0 xec
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\third_party\v8\src\api.cc(2976) v8::Object::GetOwnPropertyNames+0x182
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\mongo\scripting\engine_v8.cpp(1658) mongo::V8Scope::v8ToMongo+0x210
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\mongo\scripting\v8_db.cpp(253) mongo::mongoInsert+0x66f
Fri Mar 21 02:21:02.835 [conn7] mongod.exe ...\src\mongo\scripting\engine_v8.cpp(614) mongo::V8Scope::v8Callback+0x136
Fri Mar 21 02:21:02.835 [conn7]     ???
Fri Mar 21 02:21:02.835 [conn7]     ???
Fri Mar 21 02:21:02.835 [conn7]     ???
Fri Mar 21 02:21:02.835 [conn7]     ???
Fri Mar 21 02:21:02.835 [conn7]     ???
Fri Mar 21 02:21:02.835       pure virtual


 Comments   
Comment by Benety Goh [ 15/May/14 ]

fixed by this recent commit:

Message: SERVER-13798 add dependency on connection to cursor object tracker in JavaScript scripting engine
Branch: master
https://github.com/mongodb/mongo/commit/c576cdd324f847e0f047dfa5d1bee429d659efb2

Comment by Mathias Stearn [ 21/Apr/14 ]

AndrewP Have you had a change to test the patch?

Comment by Andrew Poland [X] [ 25/Mar/14 ]

thanks,

Yes, we are running the script through db.eval().

I will try the patch and if the crash still occurs create a dump.

Comment by Mathias Stearn [ 25/Mar/14 ]

Unfortunately, I don't think I will be able to repro without documents to test this with. Would it be possible to get a dump of data (or generation script) that is known to exhibit this issue? If it is sensitive data we can send you a secure way to upload it.

Also, how exactly are you running it. The crash looks like it is in the server so I'm assuming that you aren't just running it in the shell. Are you running that function inside a db.eval()?

Additionally, we have a patch that fixes a related bug. However I'm not sure if it will solve the issue you are seeing. I'm attaching both the 2.4 and 2.6 versions of this patch if you are able to test it.

Comment by Mathias Stearn [ 21/Mar/14 ]

Is there any way you could give us a script that reproduces this behavior?

Generated at Thu Feb 08 03:31:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.