Problem with mongo 2.2.0 and java connection

703 views
Skip to first unread message

Sebastian Gutierrez

unread,
Oct 8, 2012, 10:12:13 AM10/8/12
to mongod...@googlegroups.com
Hi,


I´m starting to use mongo for a new project, and using the last 2.2.0 and the last 2.9.1 java driver


I´m getting this:

Exception in thread "ReplicaSetStatus:Updater" java.lang.OutOfMemoryError: Java heap space
at org.bson.io.PoolOutputBuffer.<init>(PoolOutputBuffer.java:223)
at com.mongodb.Mongo$1.createNew(Mongo.java:624)
at com.mongodb.Mongo$1.createNew(Mongo.java:621)
at org.bson.util.SimplePool.get(SimplePool.java:44)
at com.mongodb.OutMessage.<init>(OutMessage.java:132)
at com.mongodb.OutMessage.<init>(OutMessage.java:124)
at com.mongodb.OutMessage.query(OutMessage.java:83)
at com.mongodb.OutMessage.query(OutMessage.java:79)
at com.mongodb.OutMessage.query(OutMessage.java:75)
at com.mongodb.DBPort.findOne(DBPort.java:142)
at com.mongodb.DBPort.runCommand(DBPort.java:148)
at com.mongodb.ConnectionStatus$UpdatableNode.update(ConnectionStatus.java:184)
at com.mongodb.ReplicaSetStatus$UpdatableReplicaSetNode.update(ReplicaSetStatus.java:614)
at com.mongodb.ReplicaSetStatus$Updater.updateAll(ReplicaSetStatus.java:766)
at com.mongodb.ReplicaSetStatus$Updater.run(ReplicaSetStatus.java:736)
Exception in thread "ReplicaSetStatus:Updater" Exception in thread "ReplicaSetStatus:Updater" Exception in thread "ReplicaSetStatus:Updater" Exception in thread "ReplicaSetStatus:Updater" Exception in thread "ReplicaSetStatus:Updater" Exception in thread "ReplicaSetStatus:Updater" Exception in thread "ReplicaSetStatus:Updater" Exception


there is no query at all just connected.


I´m connected like this:

static private Mongo M;
static private DB MDB;


M = new Mongo(hosts);
M.setWriteConcern(WriteConcern.SAFE);
MDB= M.getDB( DataBase);


best regard.


Gianfranco

unread,
Oct 8, 2012, 11:01:39 AM10/8/12
to mongod...@googlegroups.com
In what platform are you compiling this? Windows, Mac, Linux, etc?

See this page for more info on this JVM heap issue:

It's not a mongodb driver or database issue.

Sebastian Gutierrez

unread,
Oct 8, 2012, 11:43:05 AM10/8/12
to mongod...@googlegroups.com
compiling on mac, running on linux 

java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)


same arquitecture I have with mysql, remember this is doing nothing. is just when starts, until my server goes down…..

ReplicaSetStatus is not from my code.. 

any idea?


thanks!




--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Octavian Covalschi

unread,
Oct 8, 2012, 1:29:22 PM10/8/12
to mongod...@googlegroups.com
Is this a web app? Are you passing any jvm args at all? Also, is this code executed only once? If yes, when?

Sebastian Gutierrez

unread,
Oct 9, 2012, 7:38:06 AM10/9/12
to mongod...@googlegroups.com
yes is a war file

is executed one, and is on a singleton class, in the startup of the application.


ejecution:

 java -jar WorkforceServer.jar JAVA_OPTS=-server -Xms128M -Xmx512M -Duser.language=es -Djava.awt.headless=true -XX:PermSize=64m -XX:MaxPermSize=128m -d64 &

this is a jetty server that deploys the war file, as I said, is doing nothing just starting, same arquitecture I have with mysql with no problems.

thanks

Sebastian Gutierrez

unread,
Oct 10, 2012, 8:55:50 AM10/10/12
to mongod...@googlegroups.com
any idea???

I´m totally lost with this.

thanks


Begin forwarded message:

Octavian Covalschi

unread,
Oct 10, 2012, 9:06:06 AM10/10/12
to mongod...@googlegroups.com
What framework are you using to create your web app? Can you check the actual memory usage with visualvm tool?

Also, can you create a simple console app with the same code used and connect to mongodb? Maybe this will narrow it down...

Octavian Covalschi

unread,
Oct 10, 2012, 10:00:02 AM10/10/12
to mongod...@googlegroups.com
Also, can you try an older version of java diver? 2.8.x or even 2.7.x ? That will help to exclude the driver..

Sebastian Gutierrez

unread,
Oct 10, 2012, 10:55:24 AM10/10/12
to mongod...@googlegroups.com
the components are:

JAX and Jersey for RESTFull webservice, as I said, everything is the same as I have on other apps that serves many connections with mysql with no problem.

is there anyway to give more log?? or give someone access to check? Im evaluating NoSQL databases for a big project, and Mongo seems like the one I would like to use, but I feel like I can´t even start with
it, I also tested driver 2.8.1 with the same result.

maybe some mongo configuration??? I haven´t touch any config since install


I will try to make a console application as soon as I can.

thanks

Jeff Yemin

unread,
Oct 10, 2012, 12:26:57 PM10/10/12
to mongod...@googlegroups.com
Try using jmap -histo to get some more information about what types of objects are responsible for the memory consumption.


Regards,
Jeff

Robert Stewart

unread,
Oct 12, 2012, 12:15:36 AM10/12/12
to mongod...@googlegroups.com
I agree with the recommendations to try VisualVM (or even jconsole) or jmap. VisualVM will be very helpful for monitoring heap growth before and after you connect to MongoDB, as well as for checking which classes' objects are occupying most of the heap.

You might also want to try the following JVM args:

-verbose:gc -Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintHeapAtGC

This will write a log file with a lot of useful info on heap usage and garbage collection. You can then tail it while connecting. Make sure the argument to -Xloggc includes a relative or absolute path to a directory your webapp can write to, such as your webapp's existing log directory.

I've used the above JVM args to track down several memory-related problems. The overhead is pretty small, so I use those settings in production with an app that has a 55 GB heap.

Robert
Reply all
Reply to author
Forward
0 new messages