mixpanel / mixpanel-java

Other
49 stars 37 forks source link

No socket timeouts; delivery blocks forever reading response #12

Closed avram closed 10 years ago

avram commented 10 years ago

We're seeing a reproducible bug where the delivery blocks forever trying to read (as in stacktrace below). It seems there should be a socket timeout here as a sanity check. I'll follow up with a PR doing that once I confirm it addresses this problem for us.

"pool-6-thread-15" #90 prio=5 os_prio=0 tid=0x00007f8b40c5f000 nid=0xef1 runnable [0x00007f8ae56e6000]
   java.lang.Thread.State: RUNNABLE
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:150)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
    - locked <0x00000006af8a0438> (a java.io.BufferedInputStream)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:701)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
    - locked <0x00000006af8a0460> (a sun.net.www.protocol.http.HttpURLConnection)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
    - locked <0x00000006af8a0460> (a sun.net.www.protocol.http.HttpURLConnection)
    at com.mixpanel.mixpanelapi.MixpanelAPI.sendData(MixpanelAPI.java:140)
    at com.mixpanel.mixpanelapi.MixpanelAPI.sendMessages(MixpanelAPI.java:163)
    at com.mixpanel.mixpanelapi.MixpanelAPI.deliver(MixpanelAPI.java:96)
    at com.mixpanel.mixpanelapi.MixpanelAPI.deliver(MixpanelAPI.java:76)
joeatwork commented 10 years ago

Outstanding! We're looking forward to your PRQ!

avram commented 10 years ago

I still need to get this change out to production on our end-- I'll follow up with a PR from the above branch when that is confirmed to resolve this. That'll take at least a day, as the issue doesn't usually manifest itself until our box has been interacting with the API for at least several hours.

joeatwork commented 10 years ago

Please let us know whether or not adding a timeout solves your problem - also, while we love pull requests, you're certainly not obligated to share your success (but we do appreciate it!) - you've already done us a favor by reporting the issue.

avram commented 10 years ago

PR #12 opened for this. Seems to have fixed things for us.

joeatwork commented 10 years ago

Fantastic! This has been merged and will be present in release 1.4.3 (headed to Maven central now)

Thanks again for your help!