[SERVER-17593] Segfault in V8 when running Java driver tests Created: 14/Mar/15  Updated: 20/Mar/15  Resolved: 20/Mar/15

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

Type: Bug Priority: Major - P3
Reporter: Pawel Assignee: Ramon Fernandez Marina
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux 64-bit


Issue Links:
Duplicate
duplicates SERVER-13824 V8-3.12 Segfaults when compiled with ... Closed
Related
related to SERVER-13824 V8-3.12 Segfaults when compiled with ... Closed
Operating System: ALL
Participants:

 Description   

running tests from java drivers, tag r2.13.0. Can reproduce this on every run.

Server log before death:

2015-03-13T17:00:30.338-0700 [conn5] dropDatabase drop-test-1378213794357801 finished
2015-03-13T17:00:30.340-0700 [conn5] CMD: drop mongo-java-driver-test.com.mongodb.DBTest
2015-03-13T17:00:30.342-0700 [conn5] assertion 17287 Can't canonicalize query: BadValue cannot compare to undefined ns:mongo-java-driver-test.myCollection query:{ name: undefined }
2015-03-13T17:00:30.342-0700 [conn5]  ntoskip:0 ntoreturn:-1
2015-03-13T17:00:30.344-0700 [conn5] error: {
        "$err" : "Can't canonicalize query: BadValue cannot compare to undefined",
        "code" : 17287
} at src/mongo/shell/query.js:131
2015-03-13T17:00:30.345-0700 [conn5] SEVERE: Invalid access at address: 0
2015-03-13T17:00:30.354-0700 [conn5] SEVERE: Got signal: 11 (Segmentation fault).
Backtrace:0xf81686 0xf80be5 0xf80ca4 0x7f108ccca0d0 0x1093156 0xef7b41 0xef8075 0xeec7b5 0xeec8b9 0x78f409 0xee7a92 0xee8399 0x9b0636 0x9b12ff 0x99aec7 0x99bfc5 0x99d439 0xc23063 0xac5fe2 0x791cfa 
 /usr/local/bin/mongod(_ZN5mongo15printStackTraceERSo+0x26) [0xf81686]
 /usr/local/bin/mongod() [0xf80be5]
 /usr/local/bin/mongod() [0xf80ca4]
 /lib64/libpthread.so.0(+0x100d0) [0x7f108ccca0d0]
 /usr/local/bin/mongod(_ZN2v82V837AdjustAmountOfExternalAllocatedMemoryEl+0x16) [0x1093156]
 /usr/local/bin/mongod(_ZN5boost6detail17sp_counted_impl_pIN5mongo10BSONHolderEE7disposeEv+0x31) [0xef7b41]
 /usr/local/bin/mongod(_ZN5mongo10ObjTrackerINS_10BSONHolderEED1Ev+0x95) [0xef8075]
 /usr/local/bin/mongod(_ZN5mongo7V8ScopeD1Ev+0xc5) [0xeec7b5]
 /usr/local/bin/mongod(_ZN5mongo7V8ScopeD0Ev+0x9) [0xeec8b9]
 /usr/local/bin/mongod(_ZN5boost6detail12shared_countD1Ev+0x39) [0x78f409]
 /usr/local/bin/mongod(_ZN5mongo11PooledScopeD1Ev+0xb2) [0xee7a92]
 /usr/local/bin/mongod(_ZN5mongo11PooledScopeD0Ev+0x9) [0xee8399]
 /usr/local/bin/mongod(_ZN5mongo6dbEvalERKSsRNS_7BSONObjERNS_14BSONObjBuilderERSs+0x9f6) [0x9b0636]
 /usr/local/bin/mongod(_ZN5mongo7CmdEval3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x25f) [0x9b12ff]
 /usr/local/bin/mongod(_ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x27) [0x99aec7]
 /usr/local/bin/mongod(_ZN5mongo7Command11execCommandEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0xe95) [0x99bfc5]
 /usr/local/bin/mongod(_ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi+0x6d9) [0x99d439]
 /usr/local/bin/mongod(_ZN5mongo11newRunQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_+0x843) [0xc23063]
 /usr/local/bin/mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x742) [0xac5fe2]
 /usr/local/bin/mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0xba) [0x791cfa]

Version:
2015-03-13T17:00:15.947-0700 [initandlisten] MongoDB starting : pid=19195 port=27017 dbpath=/var/db/mongo 64-bit host=druid
2015-03-13T17:00:15.947-0700 [initandlisten] db version v2.6.8
2015-03-13T17:00:15.947-0700 [initandlisten] git version: nogitversion
2015-03-13T17:00:15.947-0700 [initandlisten] build info: Linux druid 3.18.7-200.fc21.x86_64 #1 SMP Wed Feb 11 21:53:17 UTC 2015 x86_64 BOOST_LIB_VERSION=1_49
2015-03-13T17:00:15.947-0700 [initandlisten] allocator: tcmalloc
2015-03-13T17:00:15.948-0700 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, processManagement: { fork: true, pidFilePath: "/var/run/mongo/mongod.pid" }, storage: { dbPath: "/var/db/mongo" }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongo/mongod.log" } }

No build options were specified for build.



 Comments   
Comment by Ramon Fernandez Marina [ 20/Mar/15 ]

pawel, this looks like the same issue as SERVER-13824 (a known issue with V8 and gcc 4.9.0), so I'm marking it as a duplicate. Please see Asya's comment above.

Regards,
Ramón.

Comment by Asya Kamsky [ 16/Mar/15 ]

Looks like you are building with

gcc-c++-4.9.2-6.fc21.x86_64

You need to build with --opt=off or you can build with gcc 4.8.

Comment by Pawel [ 16/Mar/15 ]

Ramon,

you are right, this problem only happens when I build the server myself. It does not happen on the distributed binary build.
Any particular way I can debug this further? We do some modifications to the mongo server code (the code that crashes, however, is pristine as downloaded from https://fastdl.mongodb.org/src/mongodb-src-r2.6.8.tar.gz?_ga=1.103317568.1927871984.1426277508), and I'm concerned if we can't properly build it.

ldd has the same output for stock/custom built.
Compiler and binutils on my system are:
libgcc-4.9.2-6.fc21.i686
gcc-c++-4.9.2-6.fc21.x86_64
gcc-4.9.2-6.fc21.x86_64
libgcc-4.9.2-6.fc21.x86_64
binutils-2.24-30.fc21.x86_64

P.S. Thanks for cleaning the ticket up

Comment by Ramon Fernandez Marina [ 14/Mar/15 ]

Hi pawel,

I've cleaned up the ticket. As you can see cloning is not a good idea, since JIRA won't let you update the fields in the ticket header (including the description). In the future is best to just open a new ticket.

That being said, I'm not able to reproduce the behavior you describe. This is what I did:

# launch mongod; enable test commands as they're used by some java driver tests
mongod --dbpath db --logpath mongod.log --port 27017 --logappend --fork --setParameter enableTestCommands=1
 
# clone the java driver and check out r2.13.0 onto a branch
git clone https://github.com/mongodb/mongo-java-driver.git
cd mongo-java-driver
git checkout -b SERVER-17593 r2.13.0
 
# build and test
./gradlew check

I also tried without enabling test commands; some tests fail, but mongod does not crash.

Can you please upload detailed instructions on how you're doing these runs so we can try to reproduce this issue on our end?

It also seems you're running your own build, so it would be interesting to see if the you can reproduce the same crash with the official 2.6.8.

Thanks,
Ramón.

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