Skip to content

Timeout value is not respected on Android #192

Open

Description

@thefex

Request never timeouts on Android (when there is established connection and timeout is due to external server responding slow , socket-like timeout).
Reason:
OkHttpClient.SetConnectionTimeout, ReadTimeout, WriteTimeout is not used, default value of 0 means: NO TIMEOUT.

Working on fix.

Activity

  1. thefex commented on Nov 9, 2015

    @thefex
    Author

    Fixed
    Making pull request ( I updated ilbs to v2.5 too )
    Please take care of iOS separetely.

  2. added a commit that references this issue on Nov 20, 2015
  3. adammeaney commented on Jan 22, 2016

    @adammeaney

    I found with my own project that changing the OkHttpNetworkHandler to set the timeouts for the OkHttpClient to 0 (which signifies infinite), then checking the IOException for if the task was cancelled seems to be a cleaner approach.

    This lets the HttpClientHandler use the cancellation token, which gets cancelled on the C# HttpClient after the timeout finishes.

    Less hassle, no extra properties, works fairly well.

  4. alexrainman commented on Apr 25, 2016

    @alexrainman

    I am having this issue right now. I have an endpoint that takes a while so i set a 30 seconds timeout but the call timeouts before the 30 seconds, any idea?

  5. thefex commented on May 26, 2016

    @thefex
    Author

    @robertbaker I don't use ModernHttpClient anymore. I use new Xamarin HTTP stack implementation.

  6. lhaussknecht commented on Jun 29, 2016

    @lhaussknecht

    @thefex Is the Xamarin HTTP stack available in Android projects?

  7. thefex commented on Jun 29, 2016

    @thefex
    Author

    @lhaussknecht Sure it is. As opposed to the iOS projects it is not available in GUI settings. I have asked Miguel de Icaza about that - he said GUI option will be available in future (in next releases) as Android team hit release deadline. You can set it manually in code:
    var client = new HttpClient (
    new Xamarin.Android.Net.AndroidClientHandler ());

    or using @(AndroidEnvironment) build action:
    XA_HTTP_CLIENT_HANDLER_TYPE=Xamarin.Android.Net.AndroidClientHandler

  8. rubit0 commented on Jan 22, 2017

    @rubit0

    I am having kinda the same issue, timeout settings above 49 milliseconds will be ignored and the HttpClient will use the default timeout. Though, no problems on iOS.

  9. zeezment commented on Dec 6, 2017

    @zeezment

    Hi, I'm having the same issue. I'm trying to check for server availability and I set the timeout property on the HttpClient to 2 seconds but it takes over a minute to timeout. Is there a fix for this?

  10. alexrainman commented on Dec 6, 2017

    @alexrainman

    I released a new version of the plugin that fix this issue. I am planning to do more. Search for modernhttpclient-updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions