fix(transport): throw TargetClosedException for requests on disposed connections#3328
Open
mete0rfish wants to merge 2 commits into
Open
fix(transport): throw TargetClosedException for requests on disposed connections#3328mete0rfish wants to merge 2 commits into
mete0rfish wants to merge 2 commits into
Conversation
…connections Disposed connections reject new requests by throwing TargetClosedException, rather than exposing ObjectDisposedException from the task queue.
Author
|
@microsoft-github-policy-service agree [company="{your company}"]
@microsoft-github-policy-service agree |
Author
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed #3326
Summary
TargetClosedExceptionfor operations attempted afterIPlaywright.Dispose().SemaphoreSlimdisposal error. (System.ObjectDisposedException)Before
sequenceDiagram participant User as User Code participant PW as PlaywrightImpl participant Conn as Connection participant Queue as TaskQueue participant Handle as JSHandle User->>PW: playwright.Dispose() PW->>Conn: _connection.Dispose() Conn->>Queue: _queue.Dispose() Queue->>Queue: SemaphoreSlim.Dispose() Conn-->>PW: disposed User->>Handle: await handle.DisposeAsync() Handle->>Conn: SendMessageToServerAsync("dispose") Conn->>Conn: _closedError is null Conn->>Queue: EnqueueAsync() Queue->>Queue: SemaphoreSlim.WaitAsync() Queue--xConn: ObjectDisposedException Conn--xHandle: ObjectDisposedException Handle--xUser: ObjectDisposedExceptionplaywright.Dispose()disposes theTaskQueuewithout_closedError.ObjectDisposedExceptionis exposed to the user.After
sequenceDiagram participant User as User Code participant PW as PlaywrightImpl participant Conn as Connection participant Queue as TaskQueue participant Handle as JSHandle User->>PW: playwright.Dispose() PW->>Conn: _connection.Dispose() Conn->>Conn: Check and set _disposed Conn->>Conn: Set _closedError to TargetClosedException Conn->>Conn: Fail and clear pending callbacks Conn->>Queue: _queue.Dispose() Queue->>Queue: SemaphoreSlim.Dispose() Conn-->>PW: disposed User->>Handle: await handle.DisposeAsync() Handle->>Conn: SendMessageToServerAsync("dispose") Conn->>Conn: Detect _closedError Conn--xHandle: TargetClosedException Handle->>Handle: Catch target-closed error Handle-->>User: completed without exceptionTargetClosedExceptionwithout accessing theTaskQueue.