New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mongodb 4.2.2 server is crashing on model.mapReduce for any query #8438
Comments
Even this simple Query causing the crash while if I remove the query and pass empty object this same map reduce logic is working. |
The below script works fine for me: 'use strict';
const mongoose = require('mongoose');
run().catch(err => console.log(err));
async function run() {
await mongoose.connect('mongodb://localhost:27017/test', {
useNewUrlParser: true,
useUnifiedTopology: true
});
await mongoose.connection.dropDatabase();
const admin = mongoose.connection.db.admin();
const { version } = await admin.serverStatus();
console.log('Server version', version);
const Model = mongoose.model('Test', mongoose.Schema({
name: String
}));
await Model.create({ name: 'foo' });
const o = {
map: 'function() { emit(this.name, 1); }',
reduce: function(k, vals) {
return vals.length;
}
};
const res = await Model.mapReduce(o);
console.log(res.results);
} Output:
In your stack trace, it looks like there's a permissions error trying to open |
As I stated that this map reduce was working fine for last more than two years and still works for any mongodb version below 4.2.2. |
Same problem here on new PC install : during a mapReduce call :
I reproduce with this source :
the problem is the line : |
OK with 4.2.1 |
I opened an issue on MongoDB's Jira, it looks like |
MongoDB server fixed this for 4.2.3: https://jira.mongodb.org/browse/SERVER-45177 . MongoDB server 4.2.3-rc1 is available, you should upgrade if you need this bug fixed. |
My code is working fine for mongodb 4.2.1 server but for version 4.2.2 mongo db server crashes with the following stack trace:
2019-12-19T00:20:41.407+0500
F CONTROL [conn6] *** unhandled exception (access violation) at 0x00007FF6F083898D, terminating2019-12-19T00:20:41.407+0500 F CONTROL [conn6] *** access violation was a read from 0x0
2019-12-19T00:20:41.407+0500 F CONTROL [conn6] *** stack trace for unhandled exception:
2019-12-19T00:20:41.544+0500 I - [conn6] mongod.exe ...\src\mongo\db\commands\mr.cpp(239) mongo::mr::
anonymous namespace'::queryContainsMatchType+0x2d mongod.exe ...\src\mongo\db\commands\mr.cpp(1567) mongo::mr::MapReduceCommand::errmsgRun+0x970 mongod.exe ...\src\mongo\db\commands.cpp(706) mongo::ErrmsgCommandDeprecated::run+0x56 mongod.exe ...\src\mongo\db\commands.cpp(595) mongo::BasicCommand::Invocation::run+0x63 mongod.exe ...\src\mongo\db\service_entry_point_common.cpp(592) mongo::
anonymous namespace'::runCommandImpl+0x15cmongod.exe ...\src\mongo\db\service_entry_point_common.cpp(883) mongo::
anonymous namespace'::execCommandDatabase+0x165b mongod.exe ...\src\mongo\db\service_entry_point_common.cpp(1024) <lambda_84801c53d6614de25b816924ff460f13>::operator()+0x431 mongod.exe ...\src\mongo\db\service_entry_point_common.cpp(1041) mongo::
anonymous namespace'::receivedCommands+0xa9mongod.exe ...\src\mongo\db\service_entry_point_common.cpp(1324) mongo::ServiceEntryPointCommon::handleRequest+0x719
mongod.exe ...\src\mongo\db\service_entry_point_mongod.cpp(262) mongo::ServiceEntryPointMongod::handleRequest+0x3b
mongod.exe ...\src\mongo\transport\service_state_machine.cpp(441) mongo::ServiceStateMachine::_processMessage+0x1a6
mongod.exe ...\src\mongo\transport\service_state_machine.cpp(520) mongo::ServiceStateMachine::_runNextInGuard+0xc3
mongod.exe c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\functional(16707566) std::_Func_impl_no_alloc<<lambda_b23af5efc3b61ab25bff0c3bcd13382b>,void>::_Do_call+0x5d
mongod.exe ...\src\mongo\transport\service_executor_synchronous.cpp(111) mongo::transport::ServiceExecutorSynchronous::schedule+0xfd
mongod.exe ...\src\mongo\transport\service_state_machine.cpp(564) mongo::ServiceStateMachine::_scheduleNextWithGuard+0xdc
mongod.exe ...\src\mongo\transport\service_state_machine.cpp(362) mongo::ServiceStateMachine::_sourceCallback+0xb5
mongod.exe ...\src\mongo\util\future_impl.h(236) mongo::future_details::call<<lambda_11453d3742ed318fceb22af47271f4f5> &,mongo::StatusWithmongo::Message >+0xc8
mongod.exe ...\src\mongo\util\future_impl.h(1170) mongo::future_details::FutureImplmongo::Message::generalImpl<<lambda_84dd0f151b2f4865f711936667f15dc2>,<lambda_cae9c6b0b0cce4baa010a32780d25278>,<lambda_1cf5694d79052a069e4bf7caff2ed043> >+0x5f
mongod.exe ...\src\mongo\transport\service_state_machine.cpp(516) mongo::ServiceStateMachine::_runNextInGuard+0x16f
mongod.exe c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\functional(16707566) std::_Func_impl_no_alloc<<lambda_b23af5efc3b61ab25bff0c3bcd13382b>,void>::_Do_call+0x5d
mongod.exe ...\src\mongo\transport\service_executor_synchronous.cpp(125) <lambda_472996f9e6b00ec91d31b43a6cde81f7>::operator()+0x13d
mongod.exe c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\thr\xthread(230) std::_LaunchPad<std::unique_ptr<std::tuple<std::function<void __cdecl(void)> >,std::default_delete<std::tuple<std::function<void __cdecl(void)> > > > >::_Go+0x72
mongod.exe c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\thr\xthread(209) std::_Pad::_Call_func+0x9
ucrtbase.dll beginthreadex+0x142
KERNEL32.DLL BaseThreadInitThunk+0x14
2019-12-19T00:20:41.568+0500 I CONTROL [conn6] failed to open minidump file C:\Program Files\MongoDB\Server\4.2019-12-18T19-20-41.mdmp : Access is denied.
2019-12-19T00:20:41.578+0500 F CONTROL [conn6] *** immediate exit due to unhandled exception`
When I try to run after commenting the query it works fine, but for even a simple query server gets crashed.
The text was updated successfully, but these errors were encountered: