com.mongodb.MongoSocketOpenException: Exception opening socket

19,572 views
Skip to first unread message

Andrew M

unread,
May 21, 2015, 11:36:01 PM5/21/15
to mongod...@googlegroups.com
I keep getting this a lot:

INFO: Exception in monitor thread while connecting to server 192.168.0.4:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
        at com.mongodb.connection.SocketStream.open(SocketStream.java:63)
        at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114)
        at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:141)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketTimeoutException: connect timed out
        at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50)
        at com.mongodb.connection.SocketStream.open(SocketStream.java:58)


Anyone have suggestions?

Thanks!

Ross Lawley

unread,
May 22, 2015, 7:05:53 AM5/22/15
to mongod...@googlegroups.com
From the log - it seems there was a `SocketTimeoutException` when trying to connect to 192.168.0.4:27017

This can happen for a numerous reasons but the two most common are:

1) Is there a MongoDB running on 192.168.0.4:27017 at the time when you see the error message
2) Is the MongoDB running on 192.168.0.4:27017 accessible from where you are running the Java code?

Ross

Andrew M

unread,
May 24, 2015, 8:27:21 PM5/24/15
to mongod...@googlegroups.com
Yes Mongo is running and accessible.  The client application runs and then the timeouts occur at random times.  It could be some networking problem locally but I'm just wondering if this is a known issue or there is something I should reconfigure.
Thanks

Pruthvi Raj

unread,
Dec 26, 2015, 6:32:00 PM12/26/15
to mongodb-user
Hey,

Did you find a fix for this issue. If i run a local instance of mongod am not facing this issue but if i don't run then am facing an issue.

Please help me with this

Thanks,
Pruthvi

antonin perrot-audet

unread,
Feb 20, 2017, 4:10:07 PM2/20/17
to mongodb-user
Hi Ross, I am trying to use the reactive stream implementation of the mongodb connector, it seems like this exception : MongoSocketOpenException is not propagated in the stream ?
Als timeouts do only close the publisher without throwing any exception.

Is that normal, or am I just not using the driver correctly ?

thanks for your help.
Best,

Antonin PA

Ross Lawley

unread,
Feb 21, 2017, 5:30:25 AM2/21/17
to mongod...@googlegroups.com
Hi Antonin,

Just to let you know as this is an old thread and not directly related to the reactive streams driver, its probably better to start a new thread.  

If you aren't getting any exceptions at all when using publishers when theres no MongoDB (eg the connection pool times out) then I would consider that a bug that should be reported in the JAVARS jira project. That way you can track progress on the issue.

All the best,

Ross

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/c9defb64-bb56-43a2-8c83-5e63c1b94502%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--


{ name     : "Ross Lawley",
  title    : "Senior Software Engineer",
  location : "London, UK",
  twitter  : ["@RossC0", "@MongoDB"],
  facebook :"MongoDB"}

Reply all
Reply to author
Forward
0 new messages