-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.4.1
-
Component/s: None
-
Environment:Ubuntu 18.04 (with XFCE). Node.js v10.17.0. MongoDB server v4.2.2. Node driver v3.4.1.
-
Empty show more show less
The below script causes the MongoDB server v4.2.2 to segfault. If you change the server version to 4.2.1 or if you remove the `$ne` from `query`, the below script works fine.
'use strict'; const mongodb = require('mongodb'); run().catch(err => { console.log(err); process.exit(1); }); async function run() { const client = await mongodb.MongoClient.connect('mongodb://localhost:27017/test', { useNewUrlParser: true, useUnifiedTopology: true, }); await client.db().collection('test').deleteMany({}); await client.db().collection('test').insertOne({ portalId: '1234', name: 'foo', reference: 'ref-1234', deleted: false }); const o = { scope: {}, out: { inline: 1 }, map: String(function () { emit(this._id, this); }), reduce: String(function (k, vals) { return { data: vals }; }), query: { deleted: { $ne: true }, } }; const res = await client.db().collection('test').mapReduce(null, null, o); console.log(res); process.exit(1); }
Not sure whether this is a server bug or not. Output from the mongod server is shown below:
2020-01-03T18:04:37.140-0500 I NETWORK [initandlisten] Listening on 127.0.0.1 2020-01-03T18:04:37.140-0500 I SHARDING [LogicalSessionCacheReap] Marking collection config.transactions as collection version: <unsharded> 2020-01-03T18:04:37.140-0500 I NETWORK [initandlisten] waiting for connections on port 27017 2020-01-03T18:04:38.000-0500 I SHARDING [ftdc] Marking collection local.oplog.rs as collection version: <unsharded> 2020-01-03T18:04:38.450-0500 I NETWORK [listener] connection accepted from 127.0.0.1:43500 #1 (1 connection now open) 2020-01-03T18:04:38.453-0500 I NETWORK [conn1] received client metadata from 127.0.0.1:43500 conn1: { driver: { name: "nodejs", version: "3.4.1" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "5.0.0-37-generic" }, platform: "'Node.js v10.17.0, LE (unified)" } 2020-01-03T18:04:38.460-0500 I SHARDING [conn1] Marking collection test.test as collection version: <unsharded> 2020-01-03T18:04:38.477-0500 I SHARDING [conn1] Marking collection test.system.js as collection version: <unsharded> 2020-01-03T18:04:38.478-0500 F - [conn1] Invalid access at address: 0 2020-01-03T18:04:38.492-0500 F - [conn1] Got signal: 11 (Segmentation fault). 0x559e09fed5f1 0x559e09fecdee 0x559e09fecfcc 0x559e095ed674 0x7f957652a890 0x559e08a23afc 0x559e08a258a3 0x559e099ea9a6 0x559e099f04f4 0x559e089338e8 0x559e08935dd4 0x559e08936b3a 0x559e0892476c 0x559e08930cec 0x559e0892c4ef 0x559e0892f77c 0x559e09732a72 0x559e08929eed 0x559e0892d1a3 0x559e0892b5b7 0x559e0892c44b 0x559e0892f77c 0x559e09732edb 0x559e09d770b4 0x7f957651f6db 0x7f957624888f ----- BEGIN BACKTRACE ----- {"backtrace":[{"b":"559E077ED000","o":"28005F1","s":"_ZN5mongo15printStackTraceERSo"},{"b":"559E077ED000","o":"27FFDEE"},{"b":"559E077ED000","o":"27FFFCC"},{"b":"559E077ED000","o":"1E00674"},{"b":"7F9576518000","o":"12890"},{"b":"559E077ED000","o":"1236AFC"},{"b":"559E077ED000","o":"12388A3","s":"_ZN5mongo2mr16MapReduceCommand9errmsgRunEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7BSONObjERS9_RNS_14BSONObjBuilderE"},{"b":"559E077ED000","o":"21FD9A6","s":"_ZN5mongo23ErrmsgCommandDeprecated3runEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7BSONObjERNS_14BSONObjBuilderE"},{"b":"559E077ED000","o":"22034F4","s":"_ZN5mongo12BasicCommand10Invocation3runEPNS_16OperationContextEPNS_3rpc21ReplyBuilderInterfaceE"},{"b":"559E077ED000","o":"11468E8"},{"b":"559E077ED000","o":"1148DD4"},{"b":"559E077ED000","o":"1149B3A","s":"_ZN5mongo23ServiceEntryPointCommon13handleRequestEPNS_16OperationContextERKNS_7MessageERKNS0_5HooksE"},{"b":"559E077ED000","o":"113776C","s":"_ZN5mongo23ServiceEntryPointMongod13handleRequestEPNS_16OperationContextERKNS_7MessageE"},{"b":"559E077ED000","o":"1143CEC","s":"_ZN5mongo19ServiceStateMachine15_processMessageENS0_11ThreadGuardE"},{"b":"559E077ED000","o":"113F4EF","s":"_ZN5mongo19ServiceStateMachine15_runNextInGuardENS0_11ThreadGuardE"},{"b":"559E077ED000","o":"114277C"},{"b":"559E077ED000","o":"1F45A72","s":"_ZN5mongo9transport26ServiceExecutorSynchronous8scheduleESt8functionIFvvEENS0_15ServiceExecutor13ScheduleFlagsENS0_23ServiceExecutorTaskNameE"},{"b":"559E077ED000","o":"113CEED","s":"_ZN5mongo19ServiceStateMachine22_scheduleNextWithGuardENS0_11ThreadGuardENS_9transport15ServiceExecutor13ScheduleFlagsENS2_23ServiceExecutorTaskNameENS0_9OwnershipE"},{"b":"559E077ED000","o":"11401A3","s":"_ZN5mongo19ServiceStateMachine15_sourceCallbackENS_6StatusE"},{"b":"559E077ED000","o":"113E5B7","s":"_ZN5mongo19ServiceStateMachine14_sourceMessageENS0_11ThreadGuardE"},{"b":"559E077ED000","o":"113F44B","s":"_ZN5mongo19ServiceStateMachine15_runNextInGuardENS0_11ThreadGuardE"},{"b":"559E077ED000","o":"114277C"},{"b":"559E077ED000","o":"1F45EDB"},{"b":"559E077ED000","o":"258A0B4"},{"b":"7F9576518000","o":"76DB"},{"b":"7F9576127000","o":"12188F","s":"clone"}],"processInfo":{ "mongodbVersion" : "4.2.2", "gitVersion" : "a0bbbff6ada159e19298d37946ac8dc4b497eadf", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "5.0.0-37-generic", "version" : "#40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019", "machine" : "x86_64" }, "somap" : [ { "b" : "559E077ED000", "elfType" : 3, "buildId" : "5B5D26CB8531995BD4C22A22BD0C2657C9F3A2FB" }, { "b" : "7FFECD6A7000", "path" : "linux-vdso.so.1", "elfType" : 3, "buildId" : "D1AA39513462B997B99085F995A37B71714B8370" }, { "b" : "7F95779BF000", "path" : "/usr/lib/x86_64-linux-gnu/libcurl.so.4", "elfType" : 3, "buildId" : "683A1F6A8C6401C61D29715C7F38B4586A175873" }, { "b" : "7F95777A4000", "path" : "/lib/x86_64-linux-gnu/libresolv.so.2", "elfType" : 3, "buildId" : "390E9CC4C215314B6D8ADE6D6E28F8518418039C" }, { "b" : "7F9577361000", "path" : "/usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", "elfType" : 3, "buildId" : "9C228817BA6E0730F4FCCFAC6E033BD1E0C5620A" }, { "b" : "7F95770F9000", "path" : "/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0", "elfType" : 3, "buildId" : "0D054641049B9747C05D030262295DFDFDD3055D" }, { "b" : "7F9576EF5000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "25AD56E902E23B490A9CCDB08A9744D89CB95BCC" }, { "b" : "7F9576CED000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "9826FBDF57ED7D6965131074CB3C08B1009C1CD8" }, { "b" : "7F957694F000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "A33761AB8FB485311B3C85BF4253099D7CABE653" }, { "b" : "7F9576737000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "41BDC55C07D5E5B1D8AB38E2C19B1F535855E084" }, { "b" : "7F9576518000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "28C6AADE70B2D40D1F0F3D0A1A0CAD1AB816448F" }, { "b" : "7F9576127000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "B417C0BA7CC5CF06D1D1BED6652CEDB9253C60D0" }, { "b" : "7F9577C3E000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "64DF1B961228382FE18684249ED800AB1DCEAAD4" }, { "b" : "7F9575F02000", "path" : "/usr/lib/x86_64-linux-gnu/libnghttp2.so.14", "elfType" : 3, "buildId" : "4F00E5207693FDC249DA42EC6472ACA6A7B929AE" }, { "b" : "7F9575CE5000", "path" : "/usr/lib/x86_64-linux-gnu/libidn2.so.0", "elfType" : 3, "buildId" : "EE6E9462BA2491F4EE8C4E52C3323274A9366614" }, { "b" : "7F9575AC9000", "path" : "/usr/lib/x86_64-linux-gnu/librtmp.so.1", "elfType" : 3, "buildId" : "69465D8AA6B19086ABF2455A703F9168BF82A69F" }, { "b" : "7F95758BB000", "path" : "/usr/lib/x86_64-linux-gnu/libpsl.so.5", "elfType" : 3, "buildId" : "CDAF1F1946846941F9D06414EC8C812D131A168E" }, { "b" : "7F9575670000", "path" : "/usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2", "elfType" : 3, "buildId" : "00F419F64B0E70D8C5EEF7050369AA40B2A6E090" }, { "b" : "7F957541E000", "path" : "/usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2", "elfType" : 3, "buildId" : "70EEF126558D1559A0A4E334FB68E4E9AABE90CB" }, { "b" : "7F9575210000", "path" : "/usr/lib/x86_64-linux-gnu/liblber-2.4.so.2", "elfType" : 3, "buildId" : "C14042EC7BD22B9A07D2C16563FE3C2606F52AB7" }, { "b" : "7F9574FF3000", "path" : "/lib/x86_64-linux-gnu/libz.so.1", "elfType" : 3, "buildId" : "EF3E006DFE3132A41D4D4DC0E407D6EA658E11C4" }, { "b" : "7F9574C75000", "path" : "/usr/lib/x86_64-linux-gnu/libunistring.so.2", "elfType" : 3, "buildId" : "0E2784298E7D3F4D894FE130ACEFA77C3E624F72" }, { "b" : "7F9574910000", "path" : "/usr/lib/x86_64-linux-gnu/libgnutls.so.30", "elfType" : 3, "buildId" : "E5AE5C31F804BE96532D0DB2091F19E472F2D4A0" }, { "b" : "7F95746DC000", "path" : "/usr/lib/x86_64-linux-gnu/libhogweed.so.4", "elfType" : 3, "buildId" : "842BDF0B0EAAB82E19F1EABFC38769F4040FBE31" }, { "b" : "7F95744A6000", "path" : "/usr/lib/x86_64-linux-gnu/libnettle.so.6", "elfType" : 3, "buildId" : "C20D4B3BA13FCDCC3BF6857689BA9FC70BE3F6A5" }, { "b" : "7F9574225000", "path" : "/usr/lib/x86_64-linux-gnu/libgmp.so.10", "elfType" : 3, "buildId" : "D40EA9B5EC5BC46799E4A412319617BD38BE9341" }, { "b" : "7F9573F4F000", "path" : "/usr/lib/x86_64-linux-gnu/libkrb5.so.3", "elfType" : 3, "buildId" : "69FBCF425EE6DF03DE93B82FBC2FC33790E68A96" }, { "b" : "7F9573D1D000", "path" : "/usr/lib/x86_64-linux-gnu/libk5crypto.so.3", "elfType" : 3, "buildId" : "F400D5D643A7F9696DF0E6148FA99BEE6C1BDDF7" }, { "b" : "7F9573B19000", "path" : "/lib/x86_64-linux-gnu/libcom_err.so.2", "elfType" : 3, "buildId" : "17107881DF65C66B4C6D38CAB37C285FA44663BD" }, { "b" : "7F957390E000", "path" : "/usr/lib/x86_64-linux-gnu/libkrb5support.so.0", "elfType" : 3, "buildId" : "D78D71E8E016A534281B25B97CD7E5E9DB5FE00A" }, { "b" : "7F95736F3000", "path" : "/usr/lib/x86_64-linux-gnu/libsasl2.so.2", "elfType" : 3, "buildId" : "ABB7E3F40302E6509DAD1F91DFB1F04B6A5FD072" }, { "b" : "7F95734B2000", "path" : "/usr/lib/x86_64-linux-gnu/libgssapi.so.3", "elfType" : 3, "buildId" : "A1A98DB481968073636BBAECB561A3EA8ED198AE" }, { "b" : "7F9573183000", "path" : "/usr/lib/x86_64-linux-gnu/libp11-kit.so.0", "elfType" : 3, "buildId" : "8DBD451EA5651283905E16FA7DFA9908688893A3" }, { "b" : "7F9572F70000", "path" : "/usr/lib/x86_64-linux-gnu/libtasn1.so.6", "elfType" : 3, "buildId" : "6036B89A3BB671B32E01464C0C82BFA016186352" }, { "b" : "7F9572D6C000", "path" : "/lib/x86_64-linux-gnu/libkeyutils.so.1", "elfType" : 3, "buildId" : "F463E107B099910463BC32E837C73D341A52C27B" }, { "b" : "7F9572B63000", "path" : "/usr/lib/x86_64-linux-gnu/libheimntlm.so.0", "elfType" : 3, "buildId" : "C2376C5B831991591F1A67B976758185F86896D8" }, { "b" : "7F95728D6000", "path" : "/usr/lib/x86_64-linux-gnu/libkrb5.so.26", "elfType" : 3, "buildId" : "69BDEE5FA0FEEDF317308BE850F78761861D520A" }, { "b" : "7F9572634000", "path" : "/usr/lib/x86_64-linux-gnu/libasn1.so.8", "elfType" : 3, "buildId" : "315D74995AAA32DE4D15BA25F335066988B1B230" }, { "b" : "7F95723FE000", "path" : "/usr/lib/x86_64-linux-gnu/libhcrypto.so.4", "elfType" : 3, "buildId" : "6673972A1C24A89EBAFBAE696188A4CB26C6DDEB" }, { "b" : "7F95721E8000", "path" : "/usr/lib/x86_64-linux-gnu/libroken.so.18", "elfType" : 3, "buildId" : "430827C33259C12248CF44B91A9A9821114376F5" }, { "b" : "7F9571FE0000", "path" : "/usr/lib/x86_64-linux-gnu/libffi.so.6", "elfType" : 3, "buildId" : "3555B5F599C9787DFDDBF9E8DF6F706B9044D985" }, { "b" : "7F9571DB7000", "path" : "/usr/lib/x86_64-linux-gnu/libwind.so.0", "elfType" : 3, "buildId" : "93A0931B1C2818F0EA224CE6FE5E31E84A9B55BB" }, { "b" : "7F9571BA8000", "path" : "/usr/lib/x86_64-linux-gnu/libheimbase.so.1", "elfType" : 3, "buildId" : "669D4CCE42FA4382796EFFCF0C16F459F4382C4C" }, { "b" : "7F957195E000", "path" : "/usr/lib/x86_64-linux-gnu/libhx509.so.5", "elfType" : 3, "buildId" : "4B80C543356EE0AF9039EFE7C9EA1CC1F74C426A" }, { "b" : "7F9571655000", "path" : "/usr/lib/x86_64-linux-gnu/libsqlite3.so.0", "elfType" : 3, "buildId" : "A609DB077BDC3B54A8C64BBCF82C2B7BD1CC8B98" }, { "b" : "7F957141D000", "path" : "/lib/x86_64-linux-gnu/libcrypt.so.1", "elfType" : 3, "buildId" : "810686AF0D5FD350A4FB1CC4B5AFF44A05C102CB" } ] }} mongod(_ZN5mongo15printStackTraceERSo+0x41) [0x559e09fed5f1] mongod(+0x27FFDEE) [0x559e09fecdee] mongod(+0x27FFFCC) [0x559e09fecfcc] mongod(+0x1E00674) [0x559e095ed674] libpthread.so.0(+0x12890) [0x7f957652a890] mongod(+0x1236AFC) [0x559e08a23afc] mongod(_ZN5mongo2mr16MapReduceCommand9errmsgRunEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7BSONObjERS9_RNS_14BSONObjBuilderE+0x6B3) [0x559e08a258a3] mongod(_ZN5mongo23ErrmsgCommandDeprecated3runEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7BSONObjERNS_14BSONObjBuilderE+0x46) [0x559e099ea9a6] mongod(_ZN5mongo12BasicCommand10Invocation3runEPNS_16OperationContextEPNS_3rpc21ReplyBuilderInterfaceE+0x74) [0x559e099f04f4] mongod(+0x11468E8) [0x559e089338e8] mongod(+0x1148DD4) [0x559e08935dd4] mongod(_ZN5mongo23ServiceEntryPointCommon13handleRequestEPNS_16OperationContextERKNS_7MessageERKNS0_5HooksE+0x41A) [0x559e08936b3a] mongod(_ZN5mongo23ServiceEntryPointMongod13handleRequestEPNS_16OperationContextERKNS_7MessageE+0x3C) [0x559e0892476c] mongod(_ZN5mongo19ServiceStateMachine15_processMessageENS0_11ThreadGuardE+0xEC) [0x559e08930cec] mongod(_ZN5mongo19ServiceStateMachine15_runNextInGuardENS0_11ThreadGuardE+0x17F) [0x559e0892c4ef] mongod(+0x114277C) [0x559e0892f77c] mongod(_ZN5mongo9transport26ServiceExecutorSynchronous8scheduleESt8functionIFvvEENS0_15ServiceExecutor13ScheduleFlagsENS0_23ServiceExecutorTaskNameE+0x182) [0x559e09732a72] mongod(_ZN5mongo19ServiceStateMachine22_scheduleNextWithGuardENS0_11ThreadGuardENS_9transport15ServiceExecutor13ScheduleFlagsENS2_23ServiceExecutorTaskNameENS0_9OwnershipE+0x10D) [0x559e08929eed] mongod(_ZN5mongo19ServiceStateMachine15_sourceCallbackENS_6StatusE+0x843) [0x559e0892d1a3] mongod(_ZN5mongo19ServiceStateMachine14_sourceMessageENS0_11ThreadGuardE+0x2E7) [0x559e0892b5b7] mongod(_ZN5mongo19ServiceStateMachine15_runNextInGuardENS0_11ThreadGuardE+0xDB) [0x559e0892c44b] mongod(+0x114277C) [0x559e0892f77c] mongod(+0x1F45EDB) [0x559e09732edb] mongod(+0x258A0B4) [0x559e09d770b4] libpthread.so.0(+0x76DB) [0x7f957651f6db] libc.so.6(clone+0x3F) [0x7f957624888f] ----- END BACKTRACE ----- Segmentation fault (core dumped)
- related to
-
SERVER-45177 Not-equal ($ne) in query for mapReduce causes segmentation fault
- Closed