Bug 31446 - HttpClient.GetStringAsync randomly fails with HTTPS
Summary: HttpClient.GetStringAsync randomly fails with HTTPS
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Martin Baulig
Depends on:
Reported: 2015-06-28 07:54 UTC by wisse.aarts
Modified: 2017-04-04 13:12 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description wisse.aarts 2015-06-28 07:54:42 UTC

I wish I could include a test case however this bug only seems to happen very randomly, and writing a test case that does 1000 web requests doesn't seem to trigger it. 

I can provide a stacktrace: http://pastebin.com/RAAbaq2g
And the source code where it happens: https://github.com/Goz3rr/GozBot/blob/master/GozBot2/Util.cs#L109

In the stack trace I was retrieving something from the YouTube API however it happens with different sites as well, such as the Twitter API and obviously only when requesting over HTTPS. Immediately after this exception is thrown (after 40 seconds every time, so I assume it's some kind of timeout) requesting the same URL again works just fine. It doesn't seem to happen on windows either. I have tried compiling with Visual Studio 2013 and then uploading the exe or using xbuild on the server and in both builds the bug appears. I'm using 'mono --debug application.exe' to start the application.

mono --version:
    Mono JIT compiler version 4.0.1 (tarball Thu May 28 09:08:28 UTC 2015)
    Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

Server (OpenVZ VPS):
    Debian GNU/Linux 7.8 (wheezy)
    Kernel 2.6.32-042stab090.5 x86_64
Comment 1 Marek Safar 2015-07-01 12:03:03 UTC
We'll need any kind of repro for the issue
Comment 2 wisse.aarts 2015-07-01 14:09:31 UTC
Yeah I was afraid that would be the issue, as of right now I have no idea how to reproduce it so would there be a way to turn on some additional debugging that could help?
Comment 3 Marek Safar 2015-07-01 14:27:49 UTC
We don't really have any there but any test case even if it takes long time is fine
Comment 4 Marek Safar 2017-04-04 13:12:13 UTC
Please reopen when you have some repro