Mongo failing connection on 127.0.0.1/localhost

463 views
Skip to first unread message

Amnon

unread,
Apr 10, 2012, 11:38:43 AM4/10/12
to mongodb-user
Hi All,

I'm having some problems with mongo connection to local machine , this
configuration runs on my testng runs and i'm failing about 5/10 times
with :

Caused by: com.mongodb.MongoException$Network: can't call something :
domU-xx-xx-xx-xx-xx-xx/xx.xx.xx.xx:27017/events
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:227)
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:305)
at com.mongodb.DB.command(DB.java:160)
at com.mongodb.DB.command(DB.java:183)
at com.mongodb.DB.command(DB.java:144)
at com.mongodb.DB.createCollection(DB.java:103)
at org.springframework.data.mongodb.core.MongoTemplate
$15.doInDB(MongoTemplate.java:1161)
at org.springframework.data.mongodb.core.MongoTemplate
$15.doInDB(MongoTemplate.java:1159)
at
org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:
352)
... 65 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at org.bson.io.Bits.readFully(Bits.java:35)
at org.bson.io.Bits.readFully(Bits.java:28)
at com.mongodb.Response.<init>(Response.java:39)
at com.mongodb.DBPort.go(DBPort.java:128)
at com.mongodb.DBPort.call(DBPort.java:79)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:218)


Now this is the stack trace from my ec2 build machine but it's also
happening on my own local machine and other developers machines ,
we are all running different OS (osx,ubuntu 11.04/11.10,windows 7) we
are all using mongo 2.0.1 (tried different versions and it also
happened) ...
I've tried both with localhost and 127.0.0.1 and nothing helped i
can't find anything in mongodb.log , is there any known issue with
local connections ?
of course that mongo is up during that time and i can connect to it
from the command line and if i re run the tests it works.... for some
reason localhost connections are off and on with the java driver ...

Marc

unread,
Apr 10, 2012, 12:10:50 PM4/10/12
to mongodb-user
Can you please paste the section of your Java code where you are
creating the connection to Mongo? It should be something like:
Mongo m = new Mongo("localhost", 27017);

Do these errors occur right when the connection is being made, or do
they appear at a later point in your application? If so, what is the
operation that generates these errors? Can you please paste that
code?

Are you running mongo on the default port, 27017?

Thanks.

Xavier Vdb

unread,
Apr 23, 2012, 5:40:21 PM4/23/12
to mongod...@googlegroups.com
Hello

I think my problem with the elasticsearch river is related (2.0.4 64bits + 2.7.2 driver)

https://github.com/richardwilly98/elasticsearch-river-mongodb/issues/10

with DEBUG Mode :

[2012-04-23 19:34:29,678][ERROR][river.mongodb            ] [Human Robot] [mongodb][filesysidx] Mongo gave an exception
com.mongodb.MongoException$Network: can't call something : xxx/local
        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:227)
        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:189)
        at com.mongodb.DBApiLayer$Result._advance(DBApiLayer.java:452)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:408)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:409)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:409)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:409)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:409)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:409)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:409)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:409)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:409)
        at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:409)
        at
...
...
Caused by: java.io.EOFException
        at org.bson.io.Bits.readFully(Bits.java:37)

        at org.bson.io.Bits.readFully(Bits.java:28)
        at com.mongodb.Response.<init>(Response.java:39)
        at com.mongodb.DBPort.go(DBPort.java:128)
        at com.mongodb.DBPort.call(DBPort.java:79)
        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:218)
        ... 841 more
[2012-04-23 19:34:29,708][ERROR][river.mongodb            ] [Human Robot] [mongodb][filesysidx] Mongo gave an exception
com.mongodb.MongoException$Network: can't call something : xxxx/local

        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:227)
        at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:305)
        at com.mongodb.DBCursor._check(DBCursor.java:369)
        at com.mongodb.DBCursor._hasNext(DBCursor.java:498)
        at com.mongodb.DBCursor.hasNext(DBCursor.java:523)
        at org.elasticsearch.river.mongodb.MongoDBRiver$Slurper.run(MongoDBRiver.java:355)
        at java.lang.Thread.run(Thread.java:636)
Caused by: java.io.IOException: couldn't connect to [xxxx] bc:java.net.ConnectException: Connection refused
        at com.mongodb.DBPort._open(DBPort.java:228)
        at com.mongodb.DBPort.go(DBPort.java:112)

        at com.mongodb.DBPort.call(DBPort.java:79)
        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:218)
        ... 6 more


and after, each call of elasticsearch :

[ERROR][river.mongodb            ] [Human Robot] [mongodb][profileidx] Mongo gave an exception
com.mongodb.MongoException$Network: can't call something : xxxx/local

        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:227)
        at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:305)
        at com.mongodb.DBCursor._check(DBCursor.java:369)
        at com.mongodb.DBCursor._hasNext(DBCursor.java:498)
        at com.mongodb.DBCursor.hasNext(DBCursor.java:523)
        at org.elasticsearch.river.mongodb.MongoDBRiver$Slurper.run(MongoDBRiver.java:355)
        at java.lang.Thread.run(Thread.java:636)
Caused by: java.io.IOException: couldn't connect to [xxxx] bc:java.net.ConnectException: Connection refused
        at com.mongodb.DBPort._open(DBPort.java:228)
        at com.mongodb.DBPort.go(DBPort.java:112)

        at com.mongodb.DBPort.call(DBPort.java:79)
        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:218)
        ... 6 more
Reply all
Reply to author
Forward
0 new messages