MongoDB - too many connections w/ node.js - mongodb

I'm using node.js and MongoDB for my application. Whenever I use localhost, I have no problems and the application works fine. However, on the server, the database is limiting me to 50 connections. Here's an example of the log:
Wed Jul 27 13:33:29 [initandlisten] waiting for connections on port 27017
Wed Jul 27 13:33:29 [websvr] web admin interface listening on port 28017
Wed Jul 27 13:34:50 [initandlisten] connection accepted from 127.0.0.1:42035 #1
Wed Jul 27 13:35:16 [initandlisten] connection accepted from 127.0.0.1:42181 #2
Wed Jul 27 13:35:16 [initandlisten] connection accepted from 127.0.0.1:42182 #3
Wed Jul 27 13:35:25 [initandlisten] connection accepted from 127.0.0.1:42249 #4
...
Wed Jul 27 13:36:09 [initandlisten] connection accepted from 127.0.0.1:42518 #50
Wed Jul 27 13:36:10 [initandlisten] connection accepted from 127.0.0.1:42524 #51
Wed Jul 27 13:36:10 [initandlisten] can't create new thread, closing connection
I'm launching the process with the command mongod --maxConns=5000. Does anyone know what could be causing this connection limit?

Can you post the code you're using to connect? If you're connecting to the DB on each request then you'll quickly run out of connections. In most cases it's best to share the DB connection among requests, for example by connecting on app startup.

Related

Mongodb crashes after trying to sort

I'm running mongodb 2.4.10 on a raspberry pi 3b. After few days it started to randomly crash and doesn't start without --journal. I created new database, but again it started to crash. After each crash it requires --repair.
What I noticed is it crashes after trying to sort
User.find({}).limit(10).sort({
messages: -1
}).exec(function(err, docs) {
...
});
But it works fines with find
User.find({}, function(err, docs) {
...
});
Here's full log of mongodb
Sat Feb 11 05:56:02.356
Sat Feb 11 05:56:02.356 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Sat Feb 11 05:56:02.356
Sat Feb 11 05:56:02.386 [initandlisten] MongoDB starting : pid=754 port=27017 dbpath=db 32-bit host=raspberrypi
Sat Feb 11 05:56:02.386 [initandlisten]
Sat Feb 11 05:56:02.386 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Sat Feb 11 05:56:02.386 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
Sat Feb 11 05:56:02.386 [initandlisten] ** Note that journaling defaults to off for 32 bit and is currently off.
Sat Feb 11 05:56:02.386 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
Sat Feb 11 05:56:02.386 [initandlisten]
Sat Feb 11 05:56:02.386 [initandlisten] db version v2.4.10
Sat Feb 11 05:56:02.386 [initandlisten] git version: nogitversion
Sat Feb 11 05:56:02.386 [initandlisten] build info: Linux bm-wb-03 3.19.0-trunk-armmp #1 SMP Debian 3.19.1-1~exp1+plugwash1 (2015-03-28) armv7l BOOST_LIB_VERSION=1_55
Sat Feb 11 05:56:02.386 [initandlisten] allocator: system
Sat Feb 11 05:56:02.386 [initandlisten] options: { dbpath: "db" }
Sat Feb 11 05:56:02.441 [websvr] admin web console waiting for connections on port 28017
Sat Feb 11 05:56:02.442 [initandlisten] waiting for connections on port 27017
Sat Feb 11 05:56:03.724 [initandlisten] connection accepted from 127.0.0.1:43800 #1 (1 connection now open)
Sat Feb 11 05:56:39.087 [conn1] assertion 13097 Unsupported projection option: messages ns:test.users query:{ id: 378418036.0 }
Sat Feb 11 05:56:53.794 [conn1] end connection 127.0.0.1:43800 (0 connections now open)
Sat Feb 11 05:57:01.512 [initandlisten] connection accepted from 127.0.0.1:43960 #2 (1 connection now open)
Sat Feb 11 05:57:01.786 [initandlisten] connection accepted from 127.0.0.1:43962 #3 (2 connections now open)
Sat Feb 11 05:57:01.787 [initandlisten] connection accepted from 127.0.0.1:43964 #4 (3 connections now open)
Sat Feb 11 05:57:01.787 [initandlisten] connection accepted from 127.0.0.1:43966 #5 (4 connections now open)
Sat Feb 11 05:57:08.329 [initandlisten] connection accepted from 127.0.0.1:43974 #6 (5 connections now open)
Sat Feb 11 05:57:09.474 Invalid access at address: 0x6b70f6c7 from thread: conn3
Sat Feb 11 05:57:09.474 Got signal: 7 (Bus error).
Sat Feb 11 05:57:09.479 Backtrace:
0x664160 0x16e370 0x16e6c0 0x766031a0 0x3bfa40 0x433a5c 0x430844 0x431428 0x3c5dc8 0x3c81a4 0x182474 0x64aa08
mongod(_ZN5mongo15printStackTraceERSo+0x1c) [0x664160]
mongod(_ZN5mongo10abruptQuitEi+0x2a0) [0x16e370]
mongod(_ZN5mongo24abruptQuitWithAddrSignalEiP9siginfo_tPv+0x1fc) [0x16e6c0]
/lib/arm-linux-gnueabihf/libc.so.6(__default_rt_sa_restorer_v2+0) [0x766031a0]
mongod(_ZN5mongo22BSONElementManipulator9SetNumberEd+0x98) [0x3bfa40]
mongod(_ZN5mongo11ModSetState16applyModsInPlaceEb+0x3d4) [0x433a5c]
mongod(_ZN5mongo14_updateObjectsEbPKcRKNS_7BSONObjES4_bbbRNS_7OpDebugEPNS_11RemoveSaverEbRKNS_24QueryPlanSelectionPolicyEb+0x2788) [0x430844]
mongod(_ZN5mongo13updateObjectsEPKcRKNS_7BSONObjES4_bbbRNS_7OpDebugEbRKNS_24QueryPlanSelectionPolicyE+0x70) [0x431428]
mongod(_ZN5mongo14receivedUpdateERNS_7MessageERNS_5CurOpE+0x35c) [0x3c5dc8]
mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x14b0) [0x3c81a4]
mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x9c) [0x182474]
mongod(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x420) [0x64aa08]

Unable to close connections in MongoDB - Java Driver

I am interacting with many db collections of MongoDB using Java driver. The queries are basically INSERT,DELETE and FETCH documents. Everything is working fine except the connections are open in the logs.
Below is the log file
Fri Dec 27 17:27:28.484 [initandlisten] connection accepted from 127.0.0.1:51018 #125 (41 connections now open)
Fri Dec 27 17:27:29.209 [initandlisten] connection accepted from 127.0.0.1:51020 #126 (42 connections now open)
Fri Dec 27 17:27:30.222 [initandlisten] connection accepted from 127.0.0.1:51021 #127 (43 connections now open)
Fri Dec 27 17:27:30.254 [conn126] end connection 127.0.0.1:51020 (42 connections now open)
Fri Dec 27 17:27:31.492 [conn125] info DFM::findAll(): extent 0:9f000 was empty, skipping ahead. ns:pingpong.SearchResult
Fri Dec 27 17:27:31.516 [conn125] end connection 127.0.0.1:51018 (41 connections now open)
Fri Dec 27 17:27:40.038 [initandlisten] connection accepted from 127.0.0.1:51032 #128 (42 connections now open)
Fri Dec 27 17:27:40.625 [initandlisten] connection accepted from 127.0.0.1:51033 #129 (43 connections now open)
Fri Dec 27 17:27:41.640 [initandlisten] connection accepted from 127.0.0.1:51034 #130 (44 connections now open)
Fri Dec 27 17:27:41.675 [conn129] end connection 127.0.0.1:51033 (43 connections now open)
Fri Dec 27 17:27:43.062 [conn128] end connection 127.0.0.1:51032 (42 connections now open)
Fri Dec 27 17:27:52.595 [initandlisten] connection accepted from 127.0.0.1:51037 #131 (43 connections now open)
Fri Dec 27 17:27:53.275 [initandlisten] connection accepted from 127.0.0.1:51038 #132 (44 connections now open)
Fri Dec 27 17:27:53.601 [conn131] info DFM::findAll(): extent 0:9f000 was empty, skipping ahead. ns:pingpong.SearchResult
Fri Dec 27 17:27:54.330 [initandlisten] connection accepted from 127.0.0.1:51039 #133 (45 connections now open)
Fri Dec 27 17:27:54.375 [conn132] end connection 127.0.0.1:51038 (44 connections now open)
Fri Dec 27 17:27:55.619 [conn131] end connection 127.0.0.1:51037 (43 connections now open)
Fri Dec 27 17:28:07.823 [initandlisten] connection accepted from 127.0.0.1:51042 #134 (44 connections now open)
Fri Dec 27 17:28:08.439 [initandlisten] connection accepted from 127.0.0.1:51043 #135 (45 connections now open)
Fri Dec 27 17:28:09.475 [initandlisten] connection accepted from 127.0.0.1:51044 #136 (46 connections now open)
Fri Dec 27 17:28:09.496 [conn135] info DFM::findAll(): extent 0:24000 was empty, skipping ahead. ns:pingpong.Messages
Fri Dec 27 17:28:09.509 [conn135] end connection 127.0.0.1:51043 (45 connections now open)
Fri Dec 27 17:28:10.838 [conn134] end connection 127.0.0.1:51042 (44 connections now open)
Sat Dec 28 04:10:58.018 [initandlisten] connection accepted from 127.0.0.1:53778 #137 (45 connections now open)
Sat Dec 28 04:11:04.501 [initandlisten] connection accepted from 127.0.0.1:53779 #138 (46 connections now open)
Sat Dec 28 04:11:05.561 [initandlisten] connection accepted from 127.0.0.1:53780 #139 (47 connections now open)
Sat Dec 28 04:11:05.621 [conn138] info DFM::findAll(): extent 0:24000 was empty, skipping ahead. ns:pingpong.Messages
Sat Dec 28 04:11:05.658 [conn138] info DFM::findAll(): extent 0:24000 was empty, skipping ahead. ns:pingpong.Messages
Sat Dec 28 04:11:05.699 [conn138] info DFM::findAll(): extent 0:24000 was empty, Sat Dec 28 04:11:05.737 [conn138] end connection 127.0.0.1:53779 (46 connections now open)
I am using mongoclient.close() after each of the INSERT,DELETE and FETCH commands. But still the connections are open. Am I missing something. The below is the delete code
MongoClient mongoclient;
String mobileID=getMobileID(messageid);
DBUtils dbUtils=new DBUtils();
mongoclient=dbUtils.connectToDB("pingpong");
dbUtils.deleteMessage(mobileID,messageid);
mongoclient.close();
Am I missing something. Please let me know.
As JohnnyHK mentioned that in the comments, it is not the best approach.
In the case you're building a web application (example: REST structure), and using a container for your app' (example: Tomcat 8) what you should do is declaring a shared MongoClient instance like this: private static MongoClient mongoClient;
Then you have to set up a servletContextListener and implement the basic two methods that are called when the context is initialized and/or stopped.
See below example. I'm using the mongo java driver 3.0.3, tomcat and the servlet-api 3.1.0, which is added as dependency with Maven
Dependency:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
Example:
#Path("/rest")
#WebListener
public class RESTInterface implements ServletContextListener{
private static MongoClient mongoClient;
#Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
System.out.println("initialized");
try
{
ServerAddress serverAddress = new ServerAddress(IP_connectionString,27017); //default port 27017
mongoClient = new MongoClient(serverAddress,options);
}
catch (Exception e)
{
...
}
}
#Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
System.out.println("MongoClient closed");
mongoClient.close();
}
//whatever you want with the mongoClient !
}

mongodb replica set unreachable

I am trying to configure a standalone mongodb replica set with 3 instances. I seem to have gotten into a funky state. Two of my instances went down, and I was left with all secondary nodes. I tried to follow this: http://docs.mongodb.org/manual/tutorial/reconfigure-replica-set-with-unavailable-members/
I got this error though:
rs0:SECONDARY> rs.reconfig(cfg, {force : true})
{
"errmsg" : "exception: need most members up to reconfigure, not ok : obfuscated_hostname:27019",
"code" : 13144,
"ok" : 0
}
When I look at the logs I see this:
Fri Aug 2 20:45:11.895 [initandlisten] options: { config: "/etc/mongodb1.conf",
dbpath: "/var/lib/mongodb1", logappend: "true", logpath: "/var/log/mongodb/mongodb1.log",
port: 27018, replSet: "rs0" }
Fri Aug 2 20:45:11.897 [initandlisten] journal dir=/var/lib/mongodb1/journal
Fri Aug 2 20:45:11.897 [initandlisten] recover begin
Fri Aug 2 20:45:11.897 [initandlisten] recover lsn: 0
Fri Aug 2 20:45:11.897 [initandlisten] recover /var/lib/mongodb1/journal/j._0
Fri Aug 2 20:45:11.899 [initandlisten] recover cleaning up
Fri Aug 2 20:45:11.899 [initandlisten] removeJournalFiles
Fri Aug 2 20:45:11.899 [initandlisten] recover done
Fri Aug 2 20:45:11.923 [initandlisten] waiting for connections on port 27018
Fri Aug 2 20:45:11.925 [websvr] admin web console waiting for connections on port 28018
Fri Aug 2 20:45:11.927 [rsStart] replSet I am hostname_obfuscated:27018
Fri Aug 2 20:45:11.927 [rsStart] replSet STARTUP2
Fri Aug 2 20:45:11.929 [rsHealthPoll] replset info hostname_obf:27017 thinks that we are down
Fri Aug 2 20:45:11.929 [rsHealthPoll] replSet member hostname_obf:27017 is up
Fri Aug 2 20:45:11.929 [rsHealthPoll] replSet member hostname_obf:27017 is now in state SECONDARY
Fri Aug 2 20:45:12.587 [initandlisten] connection accepted from ip_obf:52446 #1 (1 connection now open)
Fri Aug 2 20:45:12.587 [initandlisten] connection accepted from ip_obf:52447 #2 (2 connections now open)
Fri Aug 2 20:45:12.588 [conn1] end connection ip_obf:52446 (1 connection now open)
Fri Aug 2 20:45:12.928 [rsSync] replSet SECONDARY
I'm unable to connect to the mongo instances, even though the logs say that it is up and running. Any ideas on what to do here?
You did not mention which version of mongodb you are using, but I assume it is post-2.0.
I think the problem with your forced reconfiguration is that after this reconfiguration, you still need to have the minimum number of nodes for a functioning replica set, i.e. 3. But since you originally had 3 members and lost 2, there is no way you could turn that single surviving node into a functioning replica set.
Your only option for recovery would be to bring up the surviving node as a stand-alone server, backup the database, and then create a new 3-node replica set with that data.
Yes you can turn up a single secondary replica to primary if the secondary server is running fine.Do follow the below simple steps:
Step 1: Connect to member and check the current configuration
rs.conf()
Step 2: Save the current configuration to another variable.
x = rs.conf()
Step 3: Select the id,host and port of the member that is to be made as primary.
x.members = [{"_id":1,"host" : "localhost.localdomain:27017"}]
Step 4: Reconfigure the new replica set by force.
rs.reconfig(x, {force:true})
Now the desired member will be promoted as the primary.

MongoDB running without executing daemon

I installed MondoDB on my Ubuntu 13.04 and tried to run its daemon by typing in either mongod or sudo mongod, but I encountered the following message:
mongod --help for help and startup options
Thu Jun 27 05:11:02 [initandlisten] MongoDB starting : pid=11685 port=27017 dbpath=/data/db/ 64-bit host=myhost
Thu Jun 27 05:11:02 [initandlisten] db version v2.2.4, pdfile version 4.5
Thu Jun 27 05:11:02 [initandlisten] git version: nogitversion
Thu Jun 27 05:11:02 [initandlisten] build info: Linux batsu 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 BOOST_LIB_VERSION=1_49
Thu Jun 27 05:11:02 [initandlisten] options: {}
Thu Jun 27 05:11:02 [initandlisten] journal dir=/data/db/journal
Thu Jun 27 05:11:02 [initandlisten] recover : no journal files present, no recovery needed
Thu Jun 27 05:11:02 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
Thu Jun 27 05:11:02 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:28017
Thu Jun 27 05:11:02 [websvr] ERROR: addr already in use
Thu Jun 27 05:11:02 [initandlisten] ERROR: addr already in use
Thu Jun 27 05:11:02 [initandlisten] now exiting
Thu Jun 27 05:11:02 dbexit:
Thu Jun 27 05:11:02 [initandlisten] shutdown: going to close listening sockets...
Thu Jun 27 05:11:02 [initandlisten] shutdown: going to flush diaglog...
Thu Jun 27 05:11:02 [initandlisten] shutdown: going to close sockets...
Thu Jun 27 05:11:02 [initandlisten] shutdown: waiting for fs preallocator...
Thu Jun 27 05:11:02 [initandlisten] shutdown: lock for final commit...
Thu Jun 27 05:11:02 [initandlisten] shutdown: final commit...
Thu Jun 27 05:11:02 [initandlisten] shutdown: closing all files...
Thu Jun 27 05:11:02 [initandlisten] closeAllFiles() finished
Thu Jun 27 05:11:02 [initandlisten] journalCleanup...
Thu Jun 27 05:11:02 [initandlisten] removeJournalFiles
Thu Jun 27 05:11:02 [initandlisten] shutdown: removing fs lock...
Thu Jun 27 05:11:02 dbexit: really exiting now
However, when I tried to run MongoDB by typing mongo even without running its daemon, it seems that I can use MongoDB successfully. I don't start any daemon and also I have only one window in my terminal, so it would be impossible to run both daemon and main mongo program at the same time...
So the question is, why I can use MongoDB without starting any daemon process? When I use MongoDB on OS X, I always have to run daemon before using MongoDB. For your information I installed Ubuntu 13.04 via Parallels 8 on my OS X 10.8 and installed MongoDB by going with the same route as an official document explains.
Or since I use MongoDB on my OS X at port 27017, I don't have to run daemon on Virtual Ubuntu? (though I don't run daemon on OS X right now...)
When you installed mongo, it should already have run the server for you.
This is confirmed by both the fact that it says "addr already in use" (which means something is running on the mongod port) and the fact that you can use it successfully.
You can also test this by running ps wuax | grep mongo and looking for mongod in the resulting list - this list all the processes running on your computer, and then removes from this list anything that doesn't mention mongo. You may also see a line which has "grep" in it - this is the command you are currently running, which you can ignore.
When I run this on my computer, it shows:
mongodb 22394 9.1 1.0 109244 33592 ? Dsl 08:29 0:01 /usr/bin/mongod --config /etc/mongodb.conf
1001 22423 0.0 0.0 9436 904 pts/3 S+ 08:29 0:00 grep --color=auto mongo
Mongod service is running, try to stop it and init mongod with sudo command
sudo service mongodb stop
sudo mongod
Start mongod Processes
By default, MongoDB stores data in the /data/db directory. On Windows, MongoDB stores data in C:\data\db. On all platforms, MongoDB listens for connections from clients on port 27017.
To start MongoDB using all defaults, issue the following command at the system shell:
mongod
Stop mongod Processes
In a clean shutdown a mongod completes all pending operations, flushes all data to data files, and closes all data files. Other shutdowns are unclean and can compromise the validity of the data files.
To ensure a clean shutdown, always shutdown mongod instances using one of the following methods:
Use shutdownServer()
Shut down the mongod from the mongo shell using the db.shutdownServer() method as follows:
use admin
db.shutdownServer()
Calling the same method from a init script accomplishes the same result.
For systems with authorization enabled, users may only issue db.shutdownServer() when authenticated to the admin database or via the localhost interface on systems without authentication enabled.
Use --shutdown
From the Linux command line, shut down the mongod using the --shutdown option in the following command:
mongod --shutdown

Mongodb gives error during startup

Whenever I try to play with mongo's interactive shell, it dies:
somekittens#DLserver01:~$ mongo
MongoDB shell version: 2.2.2
connecting to: test
Mon Dec 17 13:14:16 DBClientCursor::init call() failed
Mon Dec 17 13:14:16 Error: Error during mongo startup. :: caused by :: 10276 DBClientBase::findN: transport error: 127.0.0.1:27017 ns: admin.$cmd query: { whatsmyuri: 1 } src/mongo/shell/mongo.js:91
exception: connect failed
I'm able to repair the install (deleting mongodb.lock, etc) and get back to this point, but it'll only die again.
/var/log/mongodb/mongodb.log
Mon Dec 17 13:14:03
Mon Dec 17 13:14:03 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Mon Dec 17 13:14:03
Mon Dec 17 13:14:03 [initandlisten] MongoDB starting : pid=2674 port=27017 dbpath=/var/lib/mongodb 32-bit host=DLserver01
Mon Dec 17 13:14:03 [initandlisten]
Mon Dec 17 13:14:03 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Mon Dec 17 13:14:03 [initandlisten] ** see http://blog.mongodb.org/post/137788967/32-bit-limitations
Mon Dec 17 13:14:03 [initandlisten] ** with --journal, the limit is lower
Mon Dec 17 13:14:03 [initandlisten]
Mon Dec 17 13:14:03 [initandlisten] db version v2.2.2, pdfile version 4.5
Mon Dec 17 13:14:03 [initandlisten] git version: d1b43b61a5308c4ad0679d34b262c5af9d664267
Mon Dec 17 13:14:03 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_49
Mon Dec 17 13:14:03 [initandlisten] options: { config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
Mon Dec 17 13:14:03 [initandlisten] Unable to check for journal files due to: boost::filesystem::basic_directory_iterator constructor: No such file or directory: "/var/lib/mongodb/journal"
Mon Dec 17 13:14:03 [initandlisten] couldn't unlink socket file /tmp/mongodb-27017.sockerrno:1 Operation not permitted skipping
Mon Dec 17 13:14:03 [initandlisten] waiting for connections on port 27017
Mon Dec 17 13:14:03 [websvr] admin web console waiting for connections on port 28017
Mon Dec 17 13:14:16 [initandlisten] connection accepted from 127.0.0.1:57631 #1 (1 connection now open)
Mon Dec 17 13:14:16 Invalid operation at address: 0x819bb23 from thread: conn1
Mon Dec 17 13:14:16 Got signal: 4 (Illegal instruction).
Mon Dec 17 13:14:16 Backtrace:
0x8759eaa 0x817033a 0x81709ff 0x20e40c 0x819bb23 0x854cd54 0x85377d1 0x846b594 0x83e5591 0x83e6c15 0x81902b4 0x8746731 0x49ad4c 0x34ed3e
/usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x2a) [0x8759eaa]
/usr/bin/mongod(_ZN5mongo10abruptQuitEi+0x3ba) [0x817033a]
/usr/bin/mongod(_ZN5mongo24abruptQuitWithAddrSignalEiP7siginfoPv+0x2af) [0x81709ff]
[0x20e40c]
/usr/bin/mongod(_ZNK5mongo7BSONObj4copyEv+0x33) [0x819bb23]
/usr/bin/mongod(_ZN5mongo11ParsedQuery4initERKNS_7BSONObjE+0x494) [0x854cd54]
/usr/bin/mongod(_ZN5mongo11ParsedQueryC1ERNS_12QueryMessageE+0x91) [0x85377d1]
/usr/bin/mongod(_ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_+0x34) [0x846b594]
/usr/bin/mongod() [0x83e5591]
/usr/bin/mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x3d5) [0x83e6c15]
/usr/bin/mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x84) [0x81902b4]
/usr/bin/mongod(_ZN5mongo3pms9threadRunEPNS_13MessagingPortE+0x421) [0x8746731]
/lib/i386-linux-gnu/libpthread.so.0(+0x6d4c) [0x49ad4c]
/lib/i386-linux-gnu/libc.so.6(clone+0x5e) [0x34ed3e]
Connecting using node's shell:
> mdb.open(function(err, db) { console.log(err) });
[Error: failed to connect to [localhost:27017]]
I've searched around for this error and found nothing of use. This is running on a fairly old server (Ubuntu 12.04 32-bit, 640MB RAM, 500MHz P2). How can I fix this?
There is an issue Invalid operation at address: 0x819b263 from thread: TTLMonitor in mongodb jira list. I think that is about your case.
A new server may be the easiest solution, otherwise you have to download the source code, make some modification and compile it youself.