[SERVER-13880] mongo client from ArchLinux packages crashes on ensureIndex() Created: 08/May/14  Updated: 10/Dec/14  Resolved: 15/May/14

Status: Closed
Project: Core Server
Component/s: Build, JavaScript, Shell
Affects Version/s: 2.6.1
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: icoz Assignee: Michael Grundy
Resolution: Duplicate Votes: 1
Labels: community-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-13824 V8-3.12 Segfaults when compiled with ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Just type "db.abc.ensureIndex(

{'m':1}

)" in mongo-shell.

Sprint: Server 2.7.1
Participants:

 Description   

Version: 2.6.1
Arch Linux, x64, kern v3.14.2

Trying to make index on non-existing collection crashes mongo-shell with errors:

$ mongo
MongoDB shell version: 2.6.1
connecting to: test
Server has startup warnings: 
2014-05-06T23:35:37.546+0400 [initandlisten] 
2014-05-06T23:35:37.546+0400 [initandlisten] ** WARNING: Readahead for /var/lib/mongodb is set to 3072KB
2014-05-06T23:35:37.546+0400 [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less
2014-05-06T23:35:37.546+0400 [initandlisten] **          http://dochub.mongodb.org/core/readahead
> db.abc.ensureIndex({'m':1})
2014-05-08T22:08:26.300+0400 mongo got signal 11 (Segmentation fault), stack trace: 
2014-05-08T22:08:26.306+0400 0x7d5f86 0x5fccd9 0x7f5997f43df0 0x9c64fc 0xa33958 0xa33994 0xa34639 0xa3887b 0xa38d5a 0x9ccdfe 0x9dca4d 0x9d22e8 0x9dd126 0x9d2370 0x9dd126 0x9d2370 0x9dd126 0x9d2370 0x9dd126 0x9d2370 
 mongo(_ZN5mongo15printStackTraceERSo+0x26) [0x7d5f86]
 mongo(_Z12quitAbruptlyi+0x109) [0x5fccd9]
 /lib/libc.so.6(+0x33df0) [0x7f5997f43df0]
 mongo(_ZN2v88internal6String11WriteToFlatItEEvPS1_PT_ii+0x3bc) [0x9c64fc]
 mongo(_ZN2v88internal33GenericStringUtf16CharacterStream10FillBufferEjj+0x38) [0xa33958]
 mongo(_ZN2v88internal28BufferedUtf16CharacterStream9ReadBlockEv+0x34) [0xa33994]
 mongo(_ZN2v88internal7Scanner20SkipMultiLineCommentEv+0x129) [0xa34639]
 mongo(_ZN2v88internal7Scanner4ScanEv+0x10eb) [0xa3887b]
 mongo(_ZN2v88internal7Scanner4NextEv+0x4a) [0xa38d5a]
 mongo(_ZN2v88internal6Parser6ExpectENS0_5Token5ValueEPb+0x5e) [0x9ccdfe]
 mongo(_ZN2v88internal6Parser10ParseBlockEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x31d) [0x9dca4d]
 mongo(_ZN2v88internal6Parser14ParseStatementEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x98) [0x9d22e8]
 mongo(_ZN2v88internal6Parser16ParseIfStatementEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x1d6) [0x9dd126]
 mongo(_ZN2v88internal6Parser14ParseStatementEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x120) [0x9d2370]
 mongo(_ZN2v88internal6Parser16ParseIfStatementEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x1d6) [0x9dd126]
 mongo(_ZN2v88internal6Parser14ParseStatementEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x120) [0x9d2370]
 mongo(_ZN2v88internal6Parser16ParseIfStatementEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x1d6) [0x9dd126]
 mongo(_ZN2v88internal6Parser14ParseStatementEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x120) [0x9d2370]
 mongo(_ZN2v88internal6Parser16ParseIfStatementEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x1d6) [0x9dd126]
 mongo(_ZN2v88internal6Parser14ParseStatementEPNS0_8ZoneListINS0_6HandleINS0_6StringEEEEEPb+0x120) [0x9d2370]



 Comments   
Comment by Felix Yan [ 02/Jul/14 ]

The tests stop here with GCC 4.9, hope it helps:

sh8754| MongoDB shell version: 2.6.3
sh8754| connecting to: 127.0.0.1:31000/test
 m31000| 2014-07-02T18:48:28.360+0900 [initandlisten] connection accepted from 127.0.0.1:50119 #3 (3 connections now open)
 m31000| 2014-07-02T18:48:29.310+0900 [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
 m31000| 2014-07-02T18:48:29.310+0900 [conn2] JavaScript execution terminated
 m31000| 2014-07-02T18:48:29.310+0900 [conn2] Count with ns: test.jstests_disk_killall and query: { $where: function () { while( 1 ) { ; } } } failed with exception: 16712 JavaScript execution terminated code: 16712
 m31000| 2014-07-02T18:48:29.310+0900 [conn2] SEVERE: Invalid access at address: 0
 m31000| 2014-07-02T18:48:29.323+0900 [conn2] SEVERE: Got signal: 11 (Segmentation fault).
 m31000| Backtrace:0xf00856 0xeffe65 0xefff24 0x7fec5e0354b0 0xf8f066 0xe6f117 0xe63f5a 0xe64079 0x76d589 0xe5f71f 0xe60009 0xacd188 0xbe86d9 0xc04fb2 0xc05da4 0xc05fd9 0xae7330 0x96bd9d 0x966097 0x966f61
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo15printStackTraceERSo+0x26) [0xf00856]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod() [0xeffe65]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod() [0xefff24]
 m31000|  /usr/lib/libpthread.so.0(+0xf4b0) [0x7fec5e0354b0]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN2v82V837AdjustAmountOfExternalAllocatedMemoryEl+0x16) [0xf8f066]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo10ObjTrackerINS_10BSONHolderEED1Ev+0x67) [0xe6f117]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo7V8ScopeD1Ev+0xda) [0xe63f5a]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo7V8ScopeD0Ev+0x9) [0xe64079]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5boost6detail12shared_countD1Ev+0x39) [0x76d589]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo11PooledScopeD1Ev+0xaf) [0xe5f71f]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo11PooledScopeD0Ev+0x9) [0xe60009]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo20WhereMatchExpressionD0Ev+0x28) [0xacd188]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo17QuerySolutionNodeD1Ev+0x69) [0xbe86d9]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo18CollectionScanNodeD0Ev+0x52) [0xc04fb2]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo20SingleSolutionRunnerD1Ev+0xa4) [0xc05da4]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo20SingleSolutionRunnerD0Ev+0x9) [0xc05fd9]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo8runCountERKSsRKNS_7BSONObjERSsRi+0xc60) [0xae7330]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo8CmdCount3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0xcd) [0x96bd9d]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x27) [0x966097]
 m31000|  /build/mongodb/src/mongodb-src-r2.6.3/mongod(_ZN5mongo7Command11execCommandEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0xc61) [0x966f61]
sh8747| 2014-07-02T18:48:29.327+0900 DBClientCursor::init call() failed
sh8754| 2014-07-02T18:48:29.327+0900 DBClientCursor::init call() failed
sh8747| 2014-07-02T18:48:29.328+0900 Error: error doing query: failed at src/mongo/shell/query.js:81
sh8754| 2014-07-02T18:48:29.328+0900 Error: error doing query: failed at src/mongo/shell/query.js:81
2014-07-02T18:48:30.310+0900 shell: stopped mongo program on port 31000
assert failed : got unexpected exitCode: 14
Error: assert failed : got unexpected exitCode: 14
    at Error (<anonymous>)
    at doassert (src/mongo/shell/assert.js:11:14)
    at assert (src/mongo/shell/assert.js:20:5)
    at /build/mongodb/src/mongodb-src-r2.6.3/jstests/disk/killall.js:45:1
2014-07-02T18:48:30.312+0900 Error: assert failed : got unexpected exitCode: 14 at src/mongo/shell/assert.js:13
failed to load: /build/mongodb/src/mongodb-src-r2.6.3/jstests/disk/killall.js

Comment by Matt Kangas [ 15/May/14 ]

Demangled version of the original stacktrace reported:

 mongo(mongo::printStackTrace(std::basic_ostream<char, std::char_traits<char> >&)+0x26) [0x7d5f86]
 mongo(quitAbruptly(int)+0x109) [0x5fccd9]
 /lib/libc.so.6(+0x33df0) [0x7f5997f43df0]
 mongo(void v8::internal::String::WriteToFlat<unsigned short>(v8::internal::String*, unsigned short*, int, int)+0x3bc) [0x9c64fc]
 mongo(v8::internal::GenericStringUtf16CharacterStream::FillBuffer(unsigned int, unsigned int)+0x38) [0xa33958]
 mongo(v8::internal::BufferedUtf16CharacterStream::ReadBlock()+0x34) [0xa33994]
 mongo(v8::internal::Scanner::SkipMultiLineComment()+0x129) [0xa34639]
 mongo(v8::internal::Scanner::Scan()+0x10eb) [0xa3887b]
 mongo(v8::internal::Scanner::Next()+0x4a) [0xa38d5a]
 mongo(v8::internal::Parser::Expect(v8::internal::Token::Value, bool*)+0x5e) [0x9ccdfe]
 mongo(v8::internal::Parser::ParseBlock(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x31d) [0x9dca4d]
 mongo(v8::internal::Parser::ParseStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x98) [0x9d22e8]
 mongo(v8::internal::Parser::ParseIfStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x1d6) [0x9dd126]
 mongo(v8::internal::Parser::ParseStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x120) [0x9d2370]
 mongo(v8::internal::Parser::ParseIfStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x1d6) [0x9dd126]
 mongo(v8::internal::Parser::ParseStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x120) [0x9d2370]
 mongo(v8::internal::Parser::ParseIfStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x1d6) [0x9dd126]
 mongo(v8::internal::Parser::ParseStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x120) [0x9d2370]
 mongo(v8::internal::Parser::ParseIfStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x1d6) [0x9dd126]
 mongo(v8::internal::Parser::ParseStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String> >*, bool*)+0x120) [0x9d2370]

This looks nearly identical to SERVER-13824. We need to spin up a host with gcc 4.9, run our full test suite on it, and see what falls out.

Comment by icoz [ 14/May/14 ]

Hmm

Now have problems with mongosniff in user-mode:

$ mongosniff
found device: bluetooth0
don't know how to handle datalink type: 201
2014-05-14T23:47:57.637+0400 Assertion failure pcap_compile(handle, &fp, const_cast< char * >( "tcp" ) , 0, mask) != -1 src/mongo/tools/sniffer.cpp 564
2014-05-14T23:47:57.643+0400 0xf621b6 0xef7616 0xee3ae0 0x751ce4 0x751e66 0x7f7beba0d000 0x74dc00
mongosniff(_ZN5mongo15printStackTraceERSo+0x26) [0xf621b6]
mongosniff(_ZN5mongo10logContextEPKc+0xc6) [0xef7616]
mongosniff(_ZN5mongo12verifyFailedEPKcS1_j+0x220) [0xee3ae0]
mongosniff(Z8toolMainiPPcS0+0x1284) [0x751ce4]
mongosniff(main+0x6) [0x751e66]
/lib/libc.so.6(__libc_start_main+0xf0) [0x7f7beba0d000]
mongosniff() [0x74dc00]
terminate called after throwing an instance of 'mongo::AssertionException'
what(): assertion src/mongo/tools/sniffer.cpp:564
(core dumped)

Comment by icoz [ 14/May/14 ]

I've tried new mongodb from post:
"So the problem is gone here if compiling with clang.
I've pushed the version as 2.6.1-2 (with all -system* as before) to [community-testing]. Please test, thanks!"

Works fine.

Comment by Matt Kangas [ 14/May/14 ]

The ArchLinux package maintainer reports that "the problem is gone here if compiling with clang." Problematic builds occurred using gcc 4.9.

https://bugs.archlinux.org/task/40284#comment122962

michael.grundy@10gen.com, can you do an A/B test on ArchLinux using gcc 4.9 and 4.8.1? I'd like to pinpoint this issue.

Comment by Matt Kangas [ 13/May/14 ]

Replied on https://bugs.archlinux.org/task/40284

The current PKGBUILD for mongodb on ArchLinux specifies a number of --use-system-X values, any of which could be incompatible. My recommendation is to remove all of them, verify that you cannot reproduce this failure, then add them back incrementally until you isolate the incompatible system library.

Comment by Michael Grundy [ 08/May/14 ]

I built up an ArchLinux vm and duplicated your results. I can't say for certain right now what is different about the way it's built that causes this. I recommend you try the binaries at https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.1.tgz .

Comment by icoz [ 08/May/14 ]

I use it from the ArchLinux package repositories.
mongodb, 2.6.1, x86_64

Comment by Michael Grundy [ 08/May/14 ]

Hi -

Sorry you're having problems. Is the version you're running from downloads.mongodb.com, or from the ArchLinux package repositories?

Thanks!

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