-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[wasm][debugger] Fix some flaky tests #64652
Merged
Merged
Conversation
This file contains 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
The test fails sometimes with: ``` [02:40:04] dbug: Inspector-3[0] Failing all waiters because: Runtime.exceptionThrown: { "timestamp": 1643683204929.399, "exceptionDetails": { "exceptionId": 2, "text": "Uncaught", "lineNumber": 0, "columnNumber": 31, "scriptId": "32", "stackTrace": { "callFrames": [ { "functionName": "", "scriptId": "32", "url": "", "lineNumber": 0, "columnNumber": 31 } ] }, "exception": { "type": "object", "subtype": "error", "className": "ReferenceError", "description": "ReferenceError: non_existant_fn is not defined\n at <anonymous>:1:32", "objectId": "1487416918028189685.1.57", "preview": { "type": "object", "subtype": "error", "description": "ReferenceError: non_existant_fn is not defined\n at <anonymous>:1:32", "overflow": false, "properties": [ { "name": "stack", "type": "string", "value": "ReferenceError: non_existant_fn is not defined\n at <anonymous>:1:32" }, { "name": "message", "type": "string", "value": "non_existant_fn is not defined" } ] } }, "executionContextId": 1 } } [02:41:02] dbug: InspectorClient-3[0] Socket is no longer open [02:41:02] dbug: InspectorClient-3[0] RunLoop stopped, reason: Cancelled. (parentToken: True, linked: True): [02:41:02] dbug: InspectorClient-3[0] Failing 0 pending cmds [02:41:02] dbug: InspectorClient-3[0] Loop ended with socket: Aborted [02:41:03] dbug: InspectorClient-4[0] connecting to ws://localhost:9400/launch-chrome-and-connect/?test_id=4 [xUnit.net 00:02:07.56] DebuggerTests.HarnessTests.ExceptionThrown [FAIL] [02:41:03] info: Microsoft.WebAssembly.Diagnostics.TestHarnessProxy[0] [testId: 4] New test request for test id 4 Failed DebuggerTests.HarnessTests.ExceptionThrown [58 s] Error Message: Assert.Throws() Failure Expected: typeof(System.ArgumentException) Actual: typeof(System.Threading.Tasks.TaskCanceledException): Test timed out (elapsed time: 60.0062617) ---- System.Threading.Tasks.TaskCanceledException : Test timed out (elapsed time: 60.0062617) Stack Trace: at DebuggerTests.DebuggerTestBase.SendCommandAndCheck(JObject args, String method, String script_loc, Int32 line, Int32 column, String function_name, Func`2 wait_for_event_fn, Func`2 locals_fn, String waitForEvent) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 523 at DebuggerTests.DebuggerTestBase.EvaluateAndCheck(String expression, String script_loc, Int32 line, Int32 column, String function_name, Func`2 wait_for_event_fn, Func`2 locals_fn) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 507 at DebuggerTests.HarnessTests.<ExceptionThrown>b__1_0() in /_/src/mono/wasm/debugger/DebuggerTestSuite/HarnessTests.cs:line 30 ----- Inner Stack Trace ----- at DebuggerTests.DebuggerTestBase.SendCommandAndCheck(JObject args, String method, String script_loc, Int32 line, Int32 column, String function_name, Func`2 wait_for_event_fn, Func`2 locals_fn, String waitForEvent) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 523 at DebuggerTests.DebuggerTestBase.EvaluateAndCheck(String expression, String script_loc, Int32 line, Int32 column, String function_name, Func`2 wait_for_event_fn, Func`2 locals_fn) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 507 at DebuggerTests.HarnessTests.<ExceptionThrown>b__1_0() in /_/src/mono/wasm/debugger/DebuggerTestSuite/HarnessTests.cs:line 30 ``` The test uses `SendCommand` to evaluate `("window.setTimeout(function() { non_existant_fn(); }, 1)` which tries to invoke the `non_existant_fn` after 1ms. This causes a `Runtime.exceptionThrown` event message to be received, and the `Inspector` fails any waiters (eg. `insp.WaitFor(READY)`). So we have: 1. SendCommand 2. insp.WaitFor But the `Runtime.exceptionThrown` can be received before we get to (2), thus the waiter from (2) never gets failed, and instead times out.
This is an inherently racy test because we might get the socket closed exception first, or the ArgumentException for the cdp events. And effectively, it's not a useful test.
`ArrayTests.InvalidValueTypeArrayIndex` isn't needed any more because array members don't have special ids now. Fixes dotnet#63560
Tagging subscribers to this area: @thaystg |
@thaystg The updated
Can we return an error instead? |
lewing
approved these changes
Feb 2, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #64483
Fixes #63560