org.lightcouch.CouchDbException: java.net.SocketException: Connection reset

136 views
Skip to first unread message

Arpit Malhotra

unread,
Jul 9, 2014, 8:27:30 PM7/9/14
to light...@googlegroups.com
 I get the org.lightcouch.CouchDbException: java.net.SocketException: Connection reset every once in a while. The couchdb logs show nothing special - I see an index update going on. Can you advise what could be causing the connection reset. 

Logs in my code
Uncaught exception in thread XYZThread_1404403800000_5. Exiting with error code 2 org.lightcouch.CouchDbException: java.net.SocketException: Connection reset
Caused by: org.lightcouch.CouchDbException: java.net.SocketException: Connection reset
        at org.lightcouch.CouchDbClientBase.executeRequest(CouchDbClientBase.java:272)
        at org.lightcouch.CouchDbClientBase.post(CouchDbClientBase.java:242)
        at org.lightcouch.CouchDbClient.bulk(CouchDbClient.java:342)
        at com.abc.store.core.StoreClient.bulk(StoreClient.java:154)
        at com.abc.store.core.Store.bulkSaveOrUpdate(Store.java:349)
        ... 4 more
Caused by: java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:196)
        at java.net.SocketInputStream.read(SocketInputStream.java:122)
        at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166)
        at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90)
        at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:281)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:92)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
        at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
        at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
        at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
        at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
        at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:715)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:520)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at org.lightcouch.CouchDbClientBase.executeRequest(CouchDbClientBase.java:268)
        ... 8 more



Couchdb logs at the same instance
[Thu, 03 Jul 2014 16:10:00 GMT] [info] [<0.137.0>] 127.0.0.1 - - POST /store/_bulk_docs 201
[Thu, 03 Jul 2014 16:10:11 GMT] [info] [<0.273.0>] Starting index update for db: store idx: _design/queries
[Thu, 03 Jul 2014 16:10:11 GMT] [info] [<0.273.0>] Index update finished for db: store idx: _design/queries
[Thu, 03 Jul 2014 16:10:11 GMT] [info] [<0.3679.21>] 127.0.0.1 - - GET /store/_design/queries/_view/docsByNameAndType?key=[%22Email%20Server%22,%22Server%22]&include_docs=true 200

Ahmed Yehia

unread,
Jul 10, 2014, 2:18:25 AM7/10/14
to light...@googlegroups.com
Hi,

I think the problem is outside the code, the network between the client and the server might cause the exception, eg. the DB server abruptly close connections, running the client behind a proxy or firewall perhaps?
I 'd try running the code against another instance to verify.

Regards


--
You received this message because you are subscribed to the Google Groups "LightCouch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightcouch+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arpit Malhotra

unread,
Jul 10, 2014, 3:56:43 PM7/10/14
to light...@googlegroups.com
Hi Ahmed,
In my case both client and server are both running locally, no firewalls. I maintain a connection pool on top of your library which works well for me. The error happens once in like 21 days or so - intermittently. 
Typically one should get a  "Connection reset by peer" instead of  "Connection reset" to mark that there was problem with the server. It seems that the problem might be client side ? I am not sure of the reasons. Any advice would be helpful

Ahmed Yehia

unread,
Jul 22, 2014, 12:50:29 AM7/22/14
to light...@googlegroups.com
Hi Aprit,

I 'm not sure what's causing the exception to be thrown. 
It does seem the client is closing the connection, but I 've seen cases where the Server causes the client to throw the same exception.
Good luck with finding a solution.

Regards



Reply all
Reply to author
Forward
0 new messages