Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix race condition that caused LaunchAsync to never resolve for chrome #2214

Merged
merged 15 commits into from Jun 13, 2023

Commits on Jun 2, 2023

  1. Fix hardkoded#2202

    Only process received messages after the discovered targets have been stored.
    leonardo-fernandes committed Jun 2, 2023
    Configuration menu
    Copy the full SHA
    ca95043 View commit details
    Browse the repository at this point in the history
  2. Change the await to only apply to attachedToTarget, leaving other mes…

    …sages unchanged.
    
    This fixes some of the unit tests, which were failing due to changes in the order of execution of initialization messages.
    leonardo-fernandes committed Jun 2, 2023
    Configuration menu
    Copy the full SHA
    5a5391b View commit details
    Browse the repository at this point in the history
  3. Remove the await for OnAttachedToTarget call, and also included a mis…

    …sing return when ignoring a target.
    leonardo-fernandes committed Jun 2, 2023
    Configuration menu
    Copy the full SHA
    f58262f View commit details
    Browse the repository at this point in the history
  4. * Fixed a race condition if a message is received before the Browser.…

    …_logger field is initialized.
    
    * Fixed a deadlock that could happen if the connection is closed on the thread that is processing received messages. TaskQueue could not be disposed on the same thread that held the semaphore.
    * Fixed a race condition if targets are created/changed concurrently before the TargetHandler is registered as an event handler.
    leonardo-fernandes committed Jun 2, 2023
    Configuration menu
    Copy the full SHA
    aabb86e View commit details
    Browse the repository at this point in the history
  5. Previous commit introduced a new race condition. It was possible that…

    … thread A could invoke `TaskQueue.Dispose()` and set `_isDisposed = 1`, which would then allow thread B to finish work setting `_held = false` but without releasing the semaphore, and then thread A would attempt `_semaphore.Wait()` entering a deadlock.
    leonardo-fernandes committed Jun 2, 2023
    Configuration menu
    Copy the full SHA
    deb351d View commit details
    Browse the repository at this point in the history
  6. It was possible for the TargetManager initialization to finish withou…

    …t having discovered all targets.
    
    This was causing unit tests such as PuppeteerConnectTests.ShouldSupportTargetFilter to fail because the test executed faster than the target discovery.
    leonardo-fernandes committed Jun 2, 2023
    Configuration menu
    Copy the full SHA
    84c3dd5 View commit details
    Browse the repository at this point in the history
  7. PR review

    leonardo-fernandes committed Jun 2, 2023
    Configuration menu
    Copy the full SHA
    dda9812 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2023

  1. Configuration menu
    Copy the full SHA
    91c5e2b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7e65695 View commit details
    Browse the repository at this point in the history
  3. OnAttachedToTarget should be executed synchronously if possible, so t…

    …hat new targets are added to `_attachedTargetsByTargetId` inside of the semaphore.
    
    Also fixes `Page.CloseAsync()` which was returning before `Target.CloseTask` resolved. This affected BrowserContextTests.ShouldFireTargetEvents on which it was possible for the test to finish before the `TargetDestroy` event.
    leonardo-fernandes committed Jun 10, 2023
    Configuration menu
    Copy the full SHA
    0d3a600 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2023

  1. Fix PuppeteerConnectTests.ShouldSupportTargetFilter.

    It was possible for the InitializeAsync to finish without all targets being initialized, and consequently the test would read an empty list of targets.
    
    The _targetDiscoveryCompletionSource should be awaited before logic that depends on _targetsIdsForInit inside of message processing, to make sure this collection was already initialized during the browser launch.
    leonardo-fernandes committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    16b9283 View commit details
    Browse the repository at this point in the history
  2. Fix OOPIFTests.ShouldDetectExistingOopifsWhenPuppeteerConnectsToAnExi…

    …stingPage.
    
    Disposing the `browser1` was closing the page, which then caused the `Page.CloseAsync()` in `PuppeteerPageBaseTest` to fail.
    
    The test code now matches upstream puppeteer.
    leonardo-fernandes committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    d7d6617 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e8199a6 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f22b62a View commit details
    Browse the repository at this point in the history
  5. Use the launcher timeout when awaiting for `_targetDiscoveryCompletio…

    …nSource`, as a defensive measure against deadlocks.
    leonardo-fernandes committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    1bbb87f View commit details
    Browse the repository at this point in the history