Skip to content

Problems with Azure Devops Reporter #7371

Closed

Description

@MattGal
  • This issue is blocking
  • This issue is causing unreasonable pain

As I've written up in https://github.com/dotnet/core-eng/issues/13026, we introduced a threading bug in https://github.com/dotnet/arcade/pull/7310/files that can crash the reporter. It may be difficult to intentionally reproduce this problem since it kind of relies on actually doing the reporting, but we can inspect the code or just revert the lock part of the change and instead just do the "don't let it pass if it doesn't finish" part of the change.

Activity

  1. alexperovich commented on May 11, 2021

    @alexperovich
    Member

    The error stack trace in https://github.com/dotnet/core-eng/issues/13026 doesn't have anything to do with the lock I added. This error is happening because the interpreter can't get the lock for "stdout" and none of my change affects locking of stdout. This error is just a very rare race condition where one of the worker threads (Thread 0x000070000f354000 in that stack trace) happens to be inside a _print call at the exact time that the process is trying to exit.

    Looking at what it was trying to print. One of the worker threads never got a chance to start, before the work was all completed and the process exited.

  2. MattGal commented on May 11, 2021

    @MattGal
    MemberAuthor

    Cool, I am mistaken. We should still perhaps use this or another issue to have the conversation about dealing with failure better.

  3. changed the title [-]Mutex bug in Azure Devops Reporter can cause crashes (regression)[/-] [+]Add Retries in Azure Devops Reporter can cause crashes (regression)[/+] on May 12, 2021
  4. changed the title [-]Add Retries in Azure Devops Reporter can cause crashes (regression)[/-] [+]Add Retries in Azure Devops Reporter (regression)[/+] on May 12, 2021
  5. changed the title [-]Add Retries in Azure Devops Reporter (regression)[/-] [+]Add Retries in Azure Devops Reporter[/+] on May 12, 2021
  6. MattGal commented on May 12, 2021

    @MattGal
    MemberAuthor

    Just had a great conversation with @safern and he made a very keen insight. Specifically, if we just update the arcade reporter behavior to just return the real, not lying exit code when Azure Devops reporter fails, it's easy to implement and gives us the best of both things; when reporting fails, the work item still can pass, and when the work item fails and reporting fails, we still fail the check, e.g.:

    if (reporting fails) 
        {work item returns the actual test case's exit code, i.e. 1} 
    else 
       {Work item returns the normal the coerced exit code (0 if 1, the actual exit code otherwise)}
    
  7. self-assigned this
    on May 17, 2021
  8. MattGal commented on May 17, 2021

    @MattGal
    MemberAuthor

    Unfortunately while interesting, this idea doesn't work as simply as I'd hoped, because there's no way to get the decision made in generating RunTests.cmd (example template).

    Without removing these lines, there's no way to make the above pseudocode work since the exit code of the test is coerced in code not owned by the Helix Arcade SDK. I will confer with some runtime folks and get an idea of what they'd like to do.

  9. added a commit that references this issue on May 17, 2021
  10. MattGal commented on May 17, 2021

    @MattGal
    MemberAuthor

    Going with the "just retry for 503s" approach, #7399

  11. MattGal commented on May 18, 2021

    @MattGal
    MemberAuthor

    This is merged and should begin flowing to main-branch Arcade consumers soon, I'll keep this in validate until I see some uptake.

  12. ericstj commented on May 18, 2021

    @ericstj
    Member

    Another hit on the threading issue: https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-52793-merge-d1edb0fae6604797b1/Microsoft.Extensions.Hosting.Functional.Tests/console.f1e93568.log?sv=2019-07-07&se=2021-06-07T20%3A07%3A07Z&sr=c&sp=rl&sig=fZdoSW%2Fcu7ZkOzwiZiYlIOE6rA4GERWu6EbZ98P3QFY%3D

    2021-05-18 20:22:27,519: INFO: 140459850491712: run(89): main: Main thread starting 10 workers
    Worker 0: starting...
    2021-05-18 20:22:27,522: INFO: 140459850491712: run(96): main: Beginning reading of test results.
    2021-05-18 20:22:27,532: INFO: 140459850491712: run(105): main: Uploading results in batches of size 1000
    2021-05-18 20:22:27,533: INFO: 140459850491712: run(110): main: Main thread finished queueing batches
    2021-05-18 20:22:27,533: INFO: 140459850491712: run(114): main: Main thread exiting
    Worker 1: starting...
    Worker 2: starting...
    Worker 5: starting...
    Worker 7: starting...
    Worker 9: starting...
    Searching '/datadisks/disk1/work/B842096F/w/BC1909DE/e/..' for log files
    Found log '/datadisks/disk1/work/B842096F/w/BC1909DE/e/../console.f1e93568.log'
    Uri 'https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-52793-merge-d1edb0fae6604797b1/Microsoft.Extensions.Hosting.Functional.Tests/console.f1e93568.log?sv=2019-07-07&se=2021-06-07T20%3A07%3A07Z&sr=c&sp=rl&sig=fZdoSW%2Fcu7ZkOzwiZiYlIOE6rA4GERWu6EbZ98P3QFY%3D'
    Generated log list: console.f1e93568.log:
      https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-52793-merge-d1edb0fae6604797b1/Microsoft.Extensions.Hosting.Functional.Tests/console.f1e93568.log?sv=2019-07-07&se=2021-06-07T20%3A07%3A07Z&sr=c&sp=rl&sig=fZdoSW%2Fcu7ZkOzwiZiYlIOE6rA4GERWu6EbZ98P3QFY%3D
    
    Searching '/datadisks/disk1/work/B842096F/w/BC1909DE/e' for test results files
    Found results file /datadisks/disk1/work/B842096F/w/BC1909DE/e/testResults.xml with format xunit
    Searching '/datadisks/disk1/work/B842096F/w/BC1909DE/uploads' for test results files
    Fatal Python error: could not acquire lock for <_io.BufferedWriter name='<stdout>'> at interpreter shutdown, possibly due to daemon threads
    
    Thread 0x00007fbf3e7fc700 (most recent call first):
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 31 in __print
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 40 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
    Thread 0x00007fbf3effd700 (most recent call first):
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 31 in __print
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 40 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
    Thread 0x00007fbf3f7fe700 (most recent call first):
      File "/usr/lib/python3.6/threading.py", line 295 in wait
      File "/usr/lib/python3.6/queue.py", line 164 in get
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 43 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
    Thread 0x00007fbf3ffff700 (most recent call first):
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 31 in __print
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 40 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
    Thread 0x00007fbf54bb1700 (most recent call first):
      File "/usr/lib/python3.6/threading.py", line 295 in wait
      File "/usr/lib/python3.6/queue.py", line 164 in get
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 43 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
    Thread 0x00007fbf553b2700 (most recent call first):
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 31 in __print
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 40 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
    Thread 0x00007fbf55bb3700 (most recent call first):
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 31 in __print
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 40 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
    Thread 0x00007fbf563b4700 (most recent call first):
      File "/usr/lib/python3.6/threading.py", line 295 in wait
      File "/usr/lib/python3.6/queue.py", line 164 in get
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 43 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
    Thread 0x00007fbf56bb5700 (most recent call first):
      File "/usr/lib/python3.6/threading.py", line 295 in wait
      File "/usr/lib/python3.6/queue.py", line 164 in get
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 43 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
    Thread 0x00007fbf573b6700 (most recent call first):
      File "/usr/lib/python3.6/threading.py", line 295 in wait
      File "/usr/lib/python3.6/queue.py", line 164 in get
      File "/datadisks/disk1/work/B842096F/p/reporter/run.py", line 43 in run
      File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
      File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap
    
  13. MattGal commented on May 19, 2021

    @MattGal
    MemberAuthor

    @ericstj I may take some stabs at this one tomorrow but it's much harder than simply adding retries to AzDO calls.

  14. changed the title [-]Add Retries in Azure Devops Reporter[/-] [+]Problems with Azure Devops Reporter[/+] on May 20, 2021
  15. added 3 commits that reference this issue on May 20, 2021
  16. MattGal commented on May 27, 2021

    @MattGal
    MemberAuthor

    Added 65 unique test run instances to the IcM, since they seem to be unable to find them.

  17. MattGal commented on May 27, 2021

    @MattGal
    MemberAuthor

    THere's not much to do here and the mitigations seem to be helping so putting in Tracking/blocked.

  18. added a commit that references this issue on May 28, 2021
  19. MattGal commented on May 28, 2021

    @MattGal
    MemberAuthor

    new PR up, we can easily avoid the race condition by eliminating the race entirely.

  20. MattGal commented on May 28, 2021

    @MattGal
    MemberAuthor

    I accidentally made what I intended to be a 2s sleep 33 minutes, and oddly pushing an updated version didn't seem to fix this; will pick this back up on Tuesday.

  21. MattGal commented on Jun 2, 2021

    @MattGal
    MemberAuthor

    Merged the PR with attempted workaround, will leave this in Validate til it makes it to Runtime.

  22. MattGal commented on Jun 9, 2021

    @MattGal
    MemberAuthor

    Current workaround is in Runtime, and seems to be holding, closing (somehow I thought I already had)

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions