Skip to content

Conversation

@kjpou1
Copy link
Contributor

@kjpou1 kjpou1 commented Dec 9, 2020

Multiple fixes for Abort.

There are multiple failures with the Abort tests causing some tests to:

  • Never end

  • Multiple GC calls that end in running out of memory.

  • Some failures are expected to fail with specific WebSocketError codes:

Error codes that are not correct tend to be when websockets tests are looking for specific error codes and messages when the browser returns NativeError and the websocket native error code instead.

failed: WebSocket is closed before the connection is established.

These need to be marked correctly and or caught and wrapped correctly.

Assert.Equal() Failure
  info: Expected: Aborted
  info: Actual:   Closed

Fixes for these should also fix some, note not all, of the memory runtime errors as per issue: #45586


Fix tests that were failing when expecting CloseSent as a valid state.

// fail: [FAIL] System.Net.WebSockets.Client.Tests(server: ws://corefx-net-http11.azurewebsites.net/WebSocket/EchoWebSocket.ashx)
//   info: Assert.Throws() Failure
//   info: Expected: typeof(System.OperationCanceledException)
//   info: Actual:   typeof(System.Net.WebSockets.WebSocketException): The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseSent'

Tests are intermittently failing with System.OperationCanceledException : The operation was canceled.

Added ActiveIssue for these two tests. #46909

It seems that sometimes the default timeout is not enough for browser so it is extended for browser environments
See issue https://github.com/dotnet/runtime/issues/46909

Further addressed in #47906


SendReceive_PartialMessageBeforeCompleteMessageArrives_Success which describes the test as Ask the remote server to echo back received messages without ever signaling "end of message". This test hangs as javascript fetch does not support this functionality.

See issue #46983 for more detailed description and native javascript tests.


Associate PR's: #44666 and #45470

Close #45586
Fix #45674

@ghost
Copy link

ghost commented Dec 9, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Multiple fixes for Abort.

There are multiple failures with the Abort tests causing some tests to:

  • Never end

  • Multiple GC calls that end in running out of memory.

  • Some failures are expected to fail with specific WebSocketError codes:

Error codes that are not correct tend to be when websockets tests are looking for specific error codes and messages when the browser returns NativeError and the websocket native error code instead.

failed: WebSocket is closed before the connection is established.

These need to be marked correctly and or caught and wrapped correctly.

Assert.Equal() Failure
  info: Expected: Aborted
  info: Actual:   Closed

Fixes for these should also fix some, note not all, of the memory runtime errors as per issue: #45586

Associate PR's: #44666 and #45470

Fix #45674

Author: kjpou1
Assignees: -
Labels:

area-System.Net

Milestone: -

- This was causing a never ending Task when aborted after a Close already executed.
- Never ended which was a cause of memory errors after left running.
- See also #45586
- Exception text not sent correctly.  This test was expecting 'Aborted'.
- Mismatched expected exception messages
- Make sure the connection is torn down.
- Multiple GC calls that end in running out of memory fixed.  #45586

```
//  [FAIL] System.Net.WebSockets.Client.Tests.CancelTest.ReceiveAsync_AfterCancellationDoReceiveAsync_ThrowsWebSocketException(server: ws://corefx-net-http11.azurewebsites.net/WebSocket/EchoWebSocket.ashx)
//   info: Assert.Equal() Failure
//   info:                                  ↓ (pos 39)
//   info: Expected: ··· an invalid state ('Aborted') for this operation. Valid state···
//   info: Actual:   ··· an invalid state ('Open') for this operation. Valid states a···
//   info:                                  ↑ (pos 39)

```
kjpou1 and others added 2 commits January 5, 2021 06:47
…browser-websocket-abort-fixes

# Conflicts:
#	src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs
@lewing
Copy link
Member

lewing commented Jan 5, 2021

/azp run runtime-libraries-mono outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

kjpou1 added 6 commits January 6, 2021 05:31
- Update tests that are resolved.
```
// fail: [FAIL] System.Net.WebSockets.Client.Tests(server: ws://corefx-net-http11.azurewebsites.net/WebSocket/EchoWebSocket.ashx)
//   info: Assert.Throws() Failure
//   info: Expected: typeof(System.OperationCanceledException)
//   info: Actual:   typeof(System.Net.WebSockets.WebSocketException): The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseSent'
```
- Fix the clean up of the task and set or cancel the task cleanly.
- intermittently failing with System.OperationCanceledException : The operation was canceled.
…tly failing with System.OperationCanceledException : The operation was canceled.

- This was an ActiveIssue #46909 but extending the time seems to do the job.
- [browser][websocket] Hang with responses without ever signaling "end of message"
- [ActiveIssue("#46983", TestPlatforms.Browser)]  // JS Fetch does not support see issue
@kjpou1 kjpou1 requested a review from stephentoub January 18, 2021 09:14
- Fix for those browsers that do not set Close and send an onClose event in certain instances i.e. firefox and safari.
- Chrome will send an onClose event and we tear down the websocket there.  Other browsers need to be handled differently.
@karelz
Copy link
Member

karelz commented Feb 4, 2021

@kjpou1 any plans for this PR? There doesn't seem to be update in last 17 days ...

@kjpou1
Copy link
Contributor Author

kjpou1 commented Feb 5, 2021

@karelz Waiting for approval. We can ping some others @marek-safar @lewing @radical @stephentoub

@lewing
Copy link
Member

lewing commented Feb 5, 2021

/azp run runtime-libraries-mono outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kjpou1
Copy link
Contributor Author

kjpou1 commented Feb 8, 2021

The errors in the outerloop are for the following:

error : Work item System.Memory.Tests
error : Work item System.Text.Json.Tests
error : Work item System.Threading.Tasks.Parallel.Tests
error : Work item System.Threading.Tasks.Tests 

@kjpou1
Copy link
Contributor Author

kjpou1 commented Feb 11, 2021

Closed by #47906 which was branched off of this PR.

@kjpou1 kjpou1 closed this Feb 11, 2021
@kjpou1 kjpou1 deleted the wasm-browser-websocket-abort-fixes branch February 12, 2021 04:33
@ghost ghost locked as resolved and limited conversation to collaborators Mar 14, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-System.Net

Projects

None yet

5 participants