Test fail

Test fail waiting request to google.com's Avatar

Test fail waiting request to google.com

16 Apr, 2015 07:32 PM

I have a test with request a google search page, but is having timeout. Has any time of block?
This test works very well inside office.

  1. Support Staff 1 Posted by Feodor Fitsner on 16 Apr, 2015 07:41 PM

    Feodor Fitsner's Avatar

    Looks like it could be accessed from Pro environment: https://ci.appveyor.com/project/FeodorFitsner/simple-console/build/...

  2. 2 Posted by Georgeo Rocco on 16 Apr, 2015 08:10 PM

    Georgeo Rocco's Avatar

    I tried with https... but still failing...

    The timeout is 10sec... Your test takes 5s...

    10 sec 305 ms
    10 sec 2 ms

    2015-04-16 16:41 GMT-03:00 Feodor Fitsner <[email blocked]>

  3. Support Staff 3 Posted by Feodor Fitsner on 16 Apr, 2015 08:12 PM

    Feodor Fitsner's Avatar

    What exact URL do you call and what code do you use to call it?

    - Feodor

  4. 4 Posted by Georgeo Rocco on 16 Apr, 2015 08:30 PM

    Georgeo Rocco's Avatar

    the url,
    1) https://www.google.com read the title
    2) https://www.google.com/123 read error on the body.

    Is the client we use to call rest APIs, on server... the code is base this

                    var request = WebRequest.Create(url);
                    request.Method = method;
                    request.ContentLength = 0;
                    request.Timeout = TIMEOUT;

                    using (var response = (HttpWebResponse)await
                        using (var stream = response.GetResponseStream())
                            if (stream == null)
                                return new ResponseContent { Body = "No content
    on response", StatusCode = HttpStatusCode.NoContent };

                            using (var reader = new StreamReader(stream))
                                var responseContent = new ResponseContent();
                                var body = await reader.ReadToEndAsync();
                                responseContent.StatusCode =
                                responseContent.Body = body;
                                return responseContent;

                catch (Exception err)
                    LOGGER.ErrorFormat("Error on requesto to {0}", url);
                    return new ResponseContent(err);

            protected class ResponseContent
                public ResponseContent()

                public ResponseContent(Exception err)
                    this.Body = err.Message;
                    var exception = err as WebException;
                    this.StatusCode = exception != null
                                    : HttpStatusCode.InternalServerError;

                public HttpStatusCode StatusCode { get; set; }
                public string Body { get; set; }

    2015-04-16 17:12 GMT-03:00 Feodor Fitsner <[email blocked]>

  5. Support Staff 5 Posted by Feodor Fitsner on 16 Apr, 2015 08:45 PM

    Feodor Fitsner's Avatar

    OK, thanks. Will try to reproduce the test. I assume you are riunning builds on Pro environment, right?

    - Feodor

  6. 6 Posted by Georgeo Rocco on 16 Apr, 2015 08:47 PM

    Georgeo Rocco's Avatar

    I hope so

    Current plan

    2015-04-16 17:45 GMT-03:00 Feodor Fitsner <[email blocked]>

  7. 7 Posted by Georgeo Rocco on 16 Apr, 2015 08:49 PM

    Georgeo Rocco's Avatar

    My e-mail on the appvoyer is [email blocked]

  8. Support Staff 8 Posted by Feodor Fitsner on 16 Apr, 2015 08:51 PM

    Feodor Fitsner's Avatar

    Great, thanks.

    - Feodor

  9. Support Staff 9 Posted by Feodor Fitsner on 16 Apr, 2015 11:15 PM

    Feodor Fitsner's Avatar

    I've tested with WebClient and HttpClient for now. It worked like a charm: https://ci.appveyor.com/project/FeodorFitsner/iisexpress-tests/buil... It was successful like 3 times in a row.

    Tests: https://github.com/FeodorFitsner/iisexpress-tests/blob/master/IIsEx...

  10. 10 Posted by Pure Krome on 17 Apr, 2015 05:51 AM

    Pure Krome's Avatar

    @ Georgeo Rocco - do you have a proxy setting in an app.config or web.config file somewhere?

  11. 11 Posted by Georgeo Rocco on 17 Apr, 2015 01:44 PM

    Georgeo Rocco's Avatar

    No, I don't have proxy configured!

  12. 12 Posted by Georgeo Rocco on 17 Apr, 2015 06:55 PM

    Georgeo Rocco's Avatar

    Still not working... Has a way to print the log on appveyor console? I
    split code in many test and look is losing something on some async ... and
    lose control! The test takes more then 20 min to stop on timeout....

  13. Support Staff 13 Posted by Feodor Fitsner on 17 Apr, 2015 07:14 PM

    Feodor Fitsner's Avatar

    I've added two more tests using WebRequest class: https://github.com/FeodorFitsner/iisexpress-tests/blob/master/IIsEx...

    They both succeed in allowed timeout interval: https://ci.appveyor.com/project/FeodorFitsner/iisexpress-tests/buil...

    I guess it's something in your tests, not a connectivity issue to google.com.

    So, what exact exception are you getting? What testing framework using? How does entire test look like?

  14. 14 Posted by Georgeo Rocco on 17 Apr, 2015 07:19 PM

    Georgeo Rocco's Avatar

    This is the problem! I'm not getting a exception... or I set the timeout
    and get test fail, or run forever!
    I'm using xunit, .Net 4.5.2.

    I don't know how get feedback from the ci, has any log4net appender for put
    a lot of messages and try to understand where is losing the control?

    2015-04-17 16:14 GMT-03:00 Feodor Fitsner <[email blocked]>

  15. Support Staff 15 Posted by Feodor Fitsner on 17 Apr, 2015 07:21 PM

    Feodor Fitsner's Avatar

    You can try writing to a file or redirect trace to a file if you have. Then you can login via RDP to see what's going on there: https://github.com/appveyor/ci/blob/master/scripts/enable-rdp.ps1

    Where do you put that timeout?

  16. 16 Posted by Georgeo Rocco on 17 Apr, 2015 07:31 PM

    Georgeo Rocco's Avatar

    Lol it's something on .Net or Xunit, try run this in Release Mode... I'm
    getting now the same error. I will try to understand what is happen!

    2015-04-17 16:21 GMT-03:00 Feodor Fitsner <[email blocked]>

  17. 17 Posted by Georgeo Rocco on 17 Apr, 2015 07:33 PM

    Georgeo Rocco's Avatar

    Sorry was not the! I run again and now is passing... :(! I Will try connect
    to server and check what is happen!

  18. 18 Posted by Georgeo Rocco on 17 Apr, 2015 08:23 PM

    Georgeo Rocco's Avatar

    Is losing control on third using, send but never back... any idea?

     using (var client = new HttpClient { Timeout =
    TimeSpan.FromSeconds(timeoutSenconds) })
                        using (var request = new
    HttpRequestMessage(method.GetHttpMethod(), url))
                            using (var result = await client.SendAsync(request))

  19. Support Staff 19 Posted by Feodor Fitsner on 17 Apr, 2015 08:27 PM

    Feodor Fitsner's Avatar

    How does containing method look like and how it's called? Looks like an issue with using async-await pattern.

    - Feodor

  20. 20 Posted by Georgeo Rocco on 17 Apr, 2015 08:34 PM

    Georgeo Rocco's Avatar

    I test many times on the VM, after some test works... the code don't
    change... If is issue on using async-await pattern, will not work
    anywhere... but works here in all machines...

    2015-04-17 17:27 GMT-03:00 Feodor Fitsner <[email blocked]>

  21. 21 Posted by Pure Krome on 17 Apr, 2015 09:41 PM

    Pure Krome's Avatar

    @Feodor - could this possibly be related to my 'test hanging' issue also?

  22. Support Staff 22 Posted by Feodor Fitsner on 17 Apr, 2015 09:45 PM

    Feodor Fitsner's Avatar

    I don't know. But as it's failing/hanging on awaitable method call I'd like to reproduce that on a smaller test if possible. I guess method containing that code is async and I'm wondering how it's being called in a test.

  23. 23 Posted by Pure Krome on 17 Apr, 2015 09:52 PM

    Pure Krome's Avatar

    Hangs on async/await happen (for me) when I do crap code like .Result in an ASP.NET project (ie. ASP.NET context). All this crap about deadlocks with the wrong context and crap. Works in console, fails in other scenario's.

    Lord Of Async/Await :: http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html

    Now, maybe with xUnit 2.0 and the runner we're using in AV .. this deadlock behavior is occuring again?

    (Note: i'm guessing and i'm not sure how to fix this. As a related note, my issue with Hanging could be related because i'm also doing async/await in my tests. Where there's smoke, there's fire...)

  24. Support Staff 24 Posted by Feodor Fitsner on 19 Apr, 2015 06:07 PM

    Feodor Fitsner's Avatar

    Could you drop me a link to one of your tests using async/await?

  25. 25 Posted by Georgeo Rocco on 20 Apr, 2015 03:27 PM

    Georgeo Rocco's Avatar

    Hi Feodor, I copy and paste the code and the test, don´t change nothing!
    And works! This make sad!

    I really believe is something magic lol. But still not working in my

    2015-04-19 15:07 GMT-03:00 Feodor Fitsner <[email blocked]>

  26. 26 Posted by Georgeo Rocco on 20 Apr, 2015 04:03 PM

    Georgeo Rocco's Avatar

    I download the xunit.console and run...

    C:\Sources\Foconet [fix-tests]> xunit.console.x86
    xUnit.net console test runner (32-bit .NET 4.0.30319.34209)
    Copyright (C) 2015 Outercurve Foundation.

    Discovering: Foconet.Tools.Test
    Discovered: Foconet.Tools.Test
    Starting: Foconet.Tools.Test
    Finished: Foconet.Tools.Test

       Foconet.Tools.Test Total: 135, Errors: 0, Failed: 0, Skipped: 0, Time:
    C:\Sources\Foconet [fix-tests]>

    the test pass... this is insane no?!?!?

  27. Support Staff 27 Posted by Feodor Fitsner on 20 Apr, 2015 05:43 PM

    Feodor Fitsner's Avatar

    Thanks for providing sample app for reproducing the issue. I see there is only one test method, but what if you have like a dozen of similar tests or so. Maybe then we could see some sort of racing condition. Could you try that please?

  28. 28 Posted by Georgeo Rocco on 20 Apr, 2015 07:59 PM

    Georgeo Rocco's Avatar

    I know racing condition is very difficult to detect, but this looks like
    more some environments issues than a RC problem.

    Is a .Net functionality, my method a static method and don't use lock, and
    don't shared state...

    I will try two things... first is generate the artifacts with all dll
    builds and run in my machine, second run by command line on CI....

    2015-04-20 14:43 GMT-03:00 Feodor Fitsner <[email blocked]>

  29. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:55 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac