iron_mq_java icon indicating copy to clipboard operation
iron_mq_java copied to clipboard

neverending connection on pull

Open jwierzbo opened this issue 9 years ago • 2 comments

Took me a lot of time to tracked this bug. Here we go:

I used threads to pull from specific queue and all the time, after some random time, my pullers stopped working accidentally. I thought that was the problem with pool thread in Java, but I was wrong. In thread dump I've seen that all my pulling-threads are stuck in same line of code - IronMqJava library Client.java:

int status = conn.getResponseCode();

In above code we make request to ironMq server, but we haven't set timeout param which by default is 0 - inifinty. So if an error happen on IronMq server our code is waiting for the response forever!

That's why I added following lines:

conn.setConnectTimeout(this.httpTimeout); conn.setReadTimeout(this.httpTimeout);

After this now I get familiar error:

 java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:152)
    at java.net.SocketInputStream.read(SocketInputStream.java:122)
    at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
    at sun.security.ssl.InputRecord.read(InputRecord.java:480)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934)
    at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:891)
    at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:689)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1324)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
    at io.iron.ironmq.Client.singleRequest(Client.java:255)
    at io.iron.ironmq.Client.request(Client.java:204)
    at io.iron.ironmq.Client.post(Client.java:185)
    at io.iron.ironmq.Queue.reserve(Queue.java:148)

I'm using forked code so I couldn't prepare fix straight.

jwierzbo avatar Jun 08 '15 06:06 jwierzbo

Why has there not been any progress/response on this bug ?

pax95 avatar Jun 15 '15 17:06 pax95

BTW above issue refers to IronMq V3 - I haven't check it with V1

jwierzbo avatar Jun 16 '15 04:06 jwierzbo