[JAVA-2910] java.lang.OutOfMemoryError on DBPort.findOne executing Created: 18/Jul/18  Updated: 11/Sep/19  Resolved: 18/Jul/18

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 2.12.3
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Gennadii Kurbatov Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Hi

I have stacktrace in heap dump file

cluster-1-127.0.0.1:27017" daemon prio=5 tid=12 RUNNABLE
    at java.lang.OutOfMemoryError.<init>(OutOfMemoryError.java:48)
    at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:149)
       Local Variable: byte[]#3200
       Local Variable: java.lang.StringCoding$StringDecoder#1
    at java.lang.StringCoding.decode(StringCoding.java:193)
    at java.lang.String.<init>(String.java:426)
    at org.bson.BasicBSONDecoder$BSONInput.readUTF8String(BasicBSONDecoder.java:544)
    at org.bson.BasicBSONDecoder.decodeElement(BasicBSONDecoder.java:230)
    at org.bson.BasicBSONDecoder._decode(BasicBSONDecoder.java:154)
    at org.bson.BasicBSONDecoder.decode(BasicBSONDecoder.java:132)
    at com.mongodb.DefaultDBDecoder.decode(DefaultDBDecoder.java:62)
       Local Variable: com.mongodb.DefaultDBCallback#1
    at com.mongodb.Response.<init>(Response.java:85)
       Local Variable: com.mongodb.Response$MyInputStream#1
       Local Variable: com.mongodb.Response#1
       Local Variable: com.mongodb.DBCollectionImpl#2
       Local Variable: com.mongodb.DefaultDBDecoder#1
    at com.mongodb.DBPort$1.execute(DBPort.java:141)
    at com.mongodb.DBPort$1.execute(DBPort.java:135)
    at com.mongodb.DBPort.doOperation(DBPort.java:164)
    at com.mongodb.DBPort.call(DBPort.java:135)
    at com.mongodb.DBPort.findOne(DBPort.java:189)
       Local Variable: com.mongodb.OutMessage#1
    at com.mongodb.DBPort.runCommand(DBPort.java:197)
       Local Variable: com.mongodb.BasicDBObject#1
    at com.mongodb.ServerMonitor.lookupServerDescription(ServerMonitor.java:236)
       Local Variable: com.mongodb.CommandResult#1
       Local Variable: com.mongodb.ServerMonitor#1
    at com.mongodb.ServerMonitor.access$400(ServerMonitor.java:39)
    at com.mongodb.ServerMonitor$ServerMonitorRunnable.run(ServerMonitor.java:90)
       Local Variable: com.mongodb.ServerDescription#1
       Local Variable: com.mongodb.DBPort#2
       Local Variable: com.mongodb.ServerMonitor$ServerMonitorRunnable#1
    at java.lang.Thread.run(Thread.java:748)

What is the reason for this error? How can I deal with it?



 Comments   
Comment by Jeffrey Yemin [ 18/Jul/18 ]

Hi wertklop

Just to let you know this project is for Java driver bugs or feature requests. The best place for questions regarding MongoDB usage or the Java driver specifics is the mongodb-user mailinglist or stackoverflow as you will reach a boarder audience there. If your business requires an answer from MongoDB within a time frame then we do offer production support.

If you do follow up via one of the options above please post a link and I will follow the conversation there.

But just to get you started: the driver itself does not use a significantly large amount of memory, so if your application is hitting an OutOfMemoryError then it's likely because the application is holding references to too many objects. The fact that the driver happens to be the one throwing the exception doesn't necessarily indicate any issue with the driver itself.

Also, I noticed you're using a driver released four years ago, which is no longer supported. I suggest you upgrade to a more recent version.

Regards,
Jeff

Generated at Thu Feb 08 08:58:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.