Skip to content

SslStream tests: timeout #15692

Closed
dotnet/corefx
#7937

Description

@stephentoub

http://dotnet-ci.cloudapp.net/job/dotnet_corefx_windows_release_prtest/6135/console

System.Net.Security.Tests.SslStreamStreamToStreamTest.SslStream_StreamToStream_Authentication_Success [FAIL]
        Handshake completed in the allotted time
        Expected: True
        Actual:   False
        Stack Trace:
           d:\j\workspace\dotnet_corefx_windows_release_prtest\src\System.Net.Security\tests\FunctionalTests\SslStreamStreamToStreamTest.cs(36,0): at System.Net.Security.Tests.SslStreamStreamToStreamTest.SslStream_StreamToStream_Authentication_Success()
     System.Net.Security.Tests.CertificateValidationClientServer.CertificateValidationClientServer_EndToEnd_Ok [FAIL]
        Client/Server Authentication timed out.
        Expected: True
        Actual:   False
        Stack Trace:
           d:\j\workspace\dotnet_corefx_windows_release_prtest\src\System.Net.Security\tests\FunctionalTests\CertificateValidationClientServer.cs(80,0): at System.Net.Security.Tests.CertificateValidationClientServer.<CertificateValidationClientServer_EndToEnd_Ok>d__0.MoveNext()
           --- End of stack trace from previous location where exception was thrown ---
              at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
              at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           --- End of stack trace from previous location where exception was thrown ---
              at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
              at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           --- End of stack trace from previous location where exception was thrown ---
              at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
              at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     System.Net.Security.Tests.ClientAsyncAuthenticateTest.ClientAsyncAuthenticate_EachProtocol_Success [FAIL]
        Timed Out
        Expected: True
        Actual:   False
        Stack Trace:
           d:\j\workspace\dotnet_corefx_windows_release_prtest\src\System.Net.Security\tests\FunctionalTests\ClientAsyncAuthenticateTest.cs(252,0): at System.Net.Security.Tests.ClientAsyncAuthenticateTest.<ClientAsyncSslHelper>d__5c.MoveNext()
           --- End of stack trace from previous location where exception was thrown ---
              at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
              at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           d:\j\workspace\dotnet_corefx_windows_release_prtest\src\System.Net.Security\tests\FunctionalTests\ClientAsyncAuthenticateTest.cs(108,0): at System.Net.Security.Tests.ClientAsyncAuthenticateTest.<ClientAsyncAuthenticate_EachProtocol_Success>d__16.MoveNext()
           --- End of stack trace from previous location where exception was thrown ---
              at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
              at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           --- End of stack trace from previous location where exception was thrown ---
              at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
              at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           --- End of stack trace from previous location where exception was thrown ---
              at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
              at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Activity

  1. CIPop commented on Nov 12, 2015

    @CIPop
    Contributor

    /cc @markwilkie
    We're already at 10s for these tests. I'll increase to 15s but, unless this is a product bug, this is simply showing that the CI system boxes are not scaling for the number of concurrent tests that they need to run.

  2. CIPop commented on Nov 12, 2015

    @CIPop
    Contributor

    For reference: on my system, the entire System.Net.Security test suite executes in about 1 second.

  3. stephentoub commented on Nov 12, 2015

    @stephentoub
    MemberAuthor

    @CIPop, I expect you're right, but should we also consider the possibility that there's a race condition / deadlock somewhere and these timeouts actually represent a real product issue? Or is that not possible?

  4. CIPop commented on Nov 13, 2015

    @CIPop
    Contributor

    consider the possibility that there's a race condition

    I'm not disregarding that possibility. If this happens after I increase the timeouts, I'll see if I can repro in my own environment or if I can add memory-dump generation code to the tests (i.e. a call to MiniDumpWriteDump ).

  5. stephentoub commented on Nov 13, 2015

    @stephentoub
    MemberAuthor

    Same three failed here: dotnet/corefx#4478 (comment)

  6. CIPop commented on Nov 16, 2015

    @CIPop
    Contributor

    Increased the timeouts to 15s.

    If this is still noticed we'll need to try to repro on a system that can be debugged and ETW can be collected. #15570 is preventing us from using the CI failures for investigation.

  7. CIPop commented on Nov 16, 2015

    @CIPop
    Contributor

    Please reopen this issue if the errors still show up in CI.

    It would be interesting to understand if the timeouts decreased the frequency of this failure.

  8. stephentoub commented on Nov 16, 2015

    @stephentoub
    MemberAuthor

    Increased the timeouts to 15s.

    When? This has been reproing fairly regularly for the last few days, in fact I'd say the regularity has actually increased.

    Please reopen this issue if the errors still show up in CI.

    They're not going to as I disabled them yesterday in dotnet/corefx#4526 due to how many PRs they were taking out.

  9. 38 remaining items

  10. davidsh commented on Apr 17, 2016

    @davidsh
    Contributor

    Just a thought...but maybe with PR dotnet/corefx#7800, these timeouts might go away?

  11. stephentoub commented on Apr 18, 2016

    @stephentoub
    MemberAuthor

    Just a thought...but maybe with PR dotnet/corefx#7800, these timeouts might go away?

    Certainly possible. It's been merged. We'll see if we continue to hit occurrences of this.

  12. CIPop commented on Apr 25, 2016

    @CIPop
    Contributor

    After all fixes I was not able to repro this in my environment.

    On machines with low CPU resources, a smaller timeout will cause this issue. If that's the case, we'll need to increase the current setting of 1 minute timeout for passing tests.
    The current timeout has been verified to work on a 12 CPU box with 100 parallel tests and 2/8CPU VMs with 20 parallel tests.

  13. CIPop commented on Dec 6, 2016

    @CIPop
    Contributor

    @karelz PTAL

  14. karelz commented on Dec 6, 2016

    @karelz
    Member

    Long thread, what's the summary I should look at?
    What I am interested:

    • What is the symptom?
    • What is the root-cause? (problematic pattern)
    • How common is the problematic pattern?
    • What is the solution?
    • How is it applicable to other tests? Can we detect them upfront or do we have to wit for them to fail?
  15. CIPop commented on Dec 6, 2016

    @CIPop
    Contributor

    What is the symptom?

    SslStream tests were intermittently failing.

    What is the root-cause? (problematic pattern)

    The tests are not written to support multiple executions in parallel. We should write proper stress/perf tests for that purpose.
    On a normal dev station this is not observed unless the machine is very busy. In CI, I've been told that it's common for the machine to be busy executing multiple requests on the same system.

    See my last comment above:

    On machines with low CPU resources, a smaller timeout will cause this issue. If that's the case, we'll need to increase the current setting of 1 minute timeout for passing tests.
    The current timeout has been verified to work on a 12 CPU box with 100 parallel tests and 2/8CPU VMs with 20 parallel tests.

    How common is the problematic pattern?

    After increasing the timeout I haven't seen failures.

    What is the solution?

    This has been fixed since April 25th.
    The fix at that time was to increase the timeout. Another potential fix was to run the tests on a machine with less CPU/network stress.

    How is it applicable to other tests?

    This is applicable to most intermittent network timeouts logged by the CI system.

    Can we detect them upfront or do we have to wit for them to fail?

    It is theoretically possible but I wouldn't expect contributors to model the CI system and come up with the right timeout.

  16. karelz commented on Dec 7, 2016

    @karelz
    Member

    SslStream tests were intermittently failing.

    What kind of failure(s)? Timeouts? Something else?

    The tests are not written to support multiple executions in parallel.

    What does it mean? Do they have shared state? Or do they have hardcoded timeouts which are too short for 'busy machines'?

    On a normal dev station this is not observed unless the machine is very busy.

    And that's a problem of the test having too aggressive expectations, it should have some room for busy machines / slow VMs / etc. Not unreasonably large timeouts, but still some room to accommodate for differences.
    What about a general timeout expression like 15s + 10 * (test_duration_on_fast_machine). The constants are of course tweakable.

    How common is the problematic pattern?

    I meant: How common is the problematic pattern (too aggressive timeout) in all tests? Is it one off? Rare? Common? Majority?

    The fix at that time was to increase the timeout. Another potential fix was to run the tests on a machine with less CPU/network stress.

    Reasonable timeout is the right fix. We should not force every developer / CI system to run on exclusive CPU/network. Again, we should be reasonable with the timeout allowances.

    This is applicable to most intermittent network timeouts logged by the CI system.

    Is there some smart/easy way how to discover all such tests? Or change them all at once?

    It is theoretically possible but I wouldn't expect contributors to model the CI system and come up with the right timeout.

    I don't follow. It should be us doing the sweep and "cleaning up" our tests, right? I wasn't suggesting enlisting contributors to do our dirty laundry :)

  17. CIPop commented on Dec 7, 2016

    @CIPop
    Contributor

    @karelz It's probably simpler if you go through the issue and the PR to answer most of your questions or we have an offline discussion to clarify more.
    I'll try to summarize here: SslStream was failing with timeouts (as the title suggests). This is expected in any service/application running on a machine running out of resources (CPU, RAM, I/O), as it reaches the threshold where the overall performance will start to decay if more operations are queued. Network, Windows services (lsass for TLS in this case), CPU and RAM are the shared resources. Another resource is Azure itself which has, by SLA, 99.9% availability (the VM stability itself).

    I don't follow. It should be us doing the sweep and "cleaning up" our tests, right? I wasn't suggesting enlisting contributors to do our dirty laundry :)

    Definitely not: what I'm saying is quite the opposite. We can't expect developers that don't have access to CI machines or specs to write a test that runs just fine on their dev machine but will fail in CI running out of resources. It's hard to write and test code that scales correctly. Fixing the test code to run in parallel with multiple instances of itself in a heavily constrained CI system would basically enlist contributors to do the heavy lifting for each test, even if it's not a stress/perf test expected to reach the limits of the system.

    Reasonable timeout is the right fix.

    I agree (see my comment in #15381).

    One problem is that the "CI tuning" process was iterative and involved me running the tests with different values over and over again in CI and using my simulation script (which itself had to be tuned to simulate the CI system on my dev box): dotnet/corefx#7937. Another problem is that as we're adding new tests, the CI system is more likely to run out of resources as several builds/tests are running in parallel on the same VM. Because of this, the system will become loaded in a different way which the likelihood of time-sensitive tests to exhibit different failure-modes.

    The next step or an alternative to make the system even more tolerant to timeouts would be a retry mechanism for everything involving network (#3697). There are downsides here:

    • In certain cases, under high load, retrying will just add more pressure on the system. This can be solved by an exponential back-off algorithm often found in networking protocols although that would also need some performance tuning to run well on the CI system.
    • Adding the mechanism will require changing the code to a more complicated version that becomes harder to read and harder to diagnose. This goes back to the non-goal of making it harder for external devs to write tests.
  18. karelz commented on Dec 7, 2016

    @karelz
    Member

    we have an offline discussion to clarify more

    Sounds good to me

    This is expected in any service/application running on a machine running out of resources (CPU, RAM, I/O), as it reaches the threshold where the overall performance will start to decay if more operations are queued.

    Yep, and that's exactly why timeouts should not be too tight. They should expect other normal operations on the system.

    Another resource is Azure itself which has, by SLA, 99.9% availability (the VM stability itself).

    That is relevant only for tests hitting Azure servers. Is that the case here -- that is vital information and the reason why we need proper write up on the failures and root-causes and not just links to GH issues where the information is scattered across large discussions.

    One problem is that the "CI tuning" process was iterative and involved me running the tests with different values over and over again in CI and using my simulation script (which itself had to be tuned to simulate the CI system on my dev box): dotnet/corefx#7937. Another problem is that as we're adding new tests, the CI system is more likely to run out of resources as several builds/tests are running in parallel on the same VM. Because of this, the system will become loaded in a different way which the likelihood of time-sensitive tests to exhibit different failure-modes.

    Why can't we just time the test on normal machine (or guess) and then apply something like "15s + 10 * (test_duration_on_fast_machine)" to determine the timeout?

    more tolerant to timeouts would be a retry mechanism for everything involving network

    That sounds like a lot of work and it pollutes the tests if I understand it correctly. I would start with cheaper solutions first (buffering timeouts).

  19. transferred this issue fromdotnet/corefxon Jan 31, 2020
  20. added this to the 1.0.0-rtm milestone on Jan 31, 2020
  21. ghost locked as resolved and limited conversation to collaborators on Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-System.Nettest-bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions