google / google/volley

Timeouts not honored

Open
#362 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.4k
Forks
751
Avg merge
8h 49m
Merged PRs (30d)
2

Description

I'm facing this problem on 1.1.0. I'll upgrade to 1.1.1, but I don't see any commits post 1.1.0 that would have addressed this problem. The request times out significantly later than what the timeout prescribed.

```
08-21 18:00:23.382 2741 2922 D MyCode : HTTP->POST->XXX
08-21 18:02:23.723 2741 2913 E MyCode : HTTP ERR<-120,342ms
08-21 18:02:23.723 2741 2741 D Volley : [2] MarkerLog.finish: (120342 ms) com.android.volley.Request$1@e43e1b5
08-21 18:02:23.723 2741 2741 D Volley : [2] MarkerLog.finish: (+0 ) [96] add-to-queue
08-21 18:02:23.723 2741 2741 D Volley : [2] MarkerLog.finish: (+1 ) [104] network-queue-take
08-21 18:02:23.723 2741 2741 D Volley : [2] MarkerLog.finish: (+120340) [104] socket-timeout-giveup [timeout=30000]
08-21 18:02:23.723 2741 2741 D Volley : [2] MarkerLog.finish: (+0 ) [104] post-error
08-21 18:02:23.724 2741 2741 D Volley : [2] MarkerLog.finish: (+1 ) [91] done
```

There was one commit to solve having total request time subtract queue waiting time, but I understand the log above indicates that the request was taken into the queue 1ms after being submitted. I have my own retry policy class (created the simplest possible since I was struggling with this problem):

```java
// https://stackoverflow.com/questions/17094718
httpRequest.setRetryPolicy(new RetryPolicy() {
@Override int getCurrentTimeout() {
return timeoutMS; // this is 30000
}
@Override int getCurrentRetryCount() {
return 0;
}
@Override void retry(VolleyError error) throws VolleyError {
throw error;
}
});

getVolleyQueue().add(httpRequest);
```

It's not consistent either, though the numbers are somewhat suspicious. In one session (consecutive requests), I get, for the same 30s specified timeout:

70,309ms
120,342ms
160,641ms
120,442ms
160,467ms

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.