Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query- Why MarkerLogs show much different millisecond values than specified timeouts. #295

Closed
gupta-sachin opened this issue Sep 24, 2019 · 1 comment

Comments

@gupta-sachin
Copy link

Below are some sample logs. Here specified timeouts are 5, 10, 20, 40 ms but as per marker logs, the attempts of request took 35, 27, 44, 301 ms respectively.

09-24 17:37:33.039 15137-15137 D/Volley: [1] MarkerLog.finish: (+0   ) [ 1] add-to-queue
09-24 17:37:33.040 15137-15137 D/Volley: [1] MarkerLog.finish: (+0   ) [2300] network-queue-take
09-24 17:37:33.042 15137-15137 D/Volley: [1] MarkerLog.finish: (+35  ) [2300] socket-retry [timeout=5]
09-24 17:37:33.042 15137-15137 D/Volley: [1] MarkerLog.finish: (+27  ) [2300] socket-retry [timeout=10]
09-24 17:37:33.045 15137-15137 D/Volley: [1] MarkerLog.finish: (+44  ) [2300] socket-retry [timeout=20]
09-24 17:37:33.045 15137-15137 D/Volley: [1] MarkerLog.finish: (+301 ) [2300] network-http-complete
09-24 17:37:33.046 15137-15137 D/Volley: [1] MarkerLog.finish: (+1   ) [2300] network-parse-complete
09-24 17:37:33.046 15137-15137 D/Volley: [1] MarkerLog.finish: (+0   ) [2300] network-cache-written
09-24 17:37:33.046 15137-15137 D/Volley: [1] MarkerLog.finish: (+0   ) [2300] post-response
09-24 17:37:33.046 15137-15137 D/Volley: [1] MarkerLog.finish: (+1   ) [ 1] done
@jpd236
Copy link
Collaborator

jpd236 commented Sep 24, 2019

The timeout values provided in the retry policy are passed to the HttpStack, and it is up to the stack to decide how to interpret / use timeouts. For example, HurlStack uses the value as the connect and read timeouts on the underlying HttpURLConnection:

https://github.com/google/volley/blob/master/src/main/java/com/android/volley/toolbox/HurlStack.java#L210

Without knowing much about the internals of HttpURLConnection, it seems plausible that the socket could successfully connect and begin returning bytes within some timeout while still taking longer to actually read the full response over the wire.

There might be a use case for specifying a global request timeout that applies across the full operation, which is probably closer to how you're thinking about the timeout, but that would be challenging to implement with Volley's current blocking architecture. It might be more feasible when Volley becomes asynchronous (see #181).

@jpd236 jpd236 closed this as completed Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants