Skip to content

Conversation

@thaystg
Copy link
Member

@thaystg thaystg commented Oct 11, 2022

Looks like this is the exception:
fail: Microsoft.WebAssembly.Diagnostics.DevToolsProxy[0] DevToolsProxy::Run: Exception System.ArgumentException: The tasks argument included a null value. (Parameter 'tasks') at System.Threading.Tasks.Task.WhenAny(Task[] tasks) at Microsoft.WebAssembly.Diagnostics.DevToolsProxy.Run(Uri browserUri, WebSocket ideSocket)

Trying to force it locally I cannot reproduce. But I'm trying to avoid the exception and adding extra log to help us to detect what is going on.

fixes #68402

…s from whenany to avoid an exception and closing the app
@thaystg thaystg requested review from lewing and radical October 11, 2022 19:44
@ghost ghost added the area-Debugger-mono label Oct 11, 2022
@ghost ghost assigned thaystg Oct 11, 2022
@ghost
Copy link

ghost commented Oct 11, 2022

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

Issue Details

Looks like this is the exception:
fail: Microsoft.WebAssembly.Diagnostics.DevToolsProxy[0] DevToolsProxy::Run: Exception System.ArgumentException: The tasks argument included a null value. (Parameter 'tasks') at System.Threading.Tasks.Task.WhenAny(Task[] tasks) at Microsoft.WebAssembly.Diagnostics.DevToolsProxy.Run(Uri browserUri, WebSocket ideSocket)

Trying to force it locally I cannot reproduce. But I'm trying to avoid the exception and adding extra log to help us to detect what is going on.

fixes #68402

Author: thaystg
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

@radical
Copy link
Member

radical commented Oct 11, 2022

The real issue here is that it's a race condition, modifying pending_ops. I fixed this in 67d8b96 .

Original commit: dotnet/runtime@fdc0d16 (#65752)

[wasm][debugger] Make DevToolsProxy's pending_ops thread-safe
Currently, `pending_ops` can get written by different threads at the
same time, and also read in parallel. This causes tests to randomly fail
with:

DevToolsProxy::Run: Exception System.ArgumentException: The tasks argument included a null value. (Parameter 'tasks')
    at System.Threading.Tasks.Task.WhenAny(Task[] tasks)
    at Microsoft.WebAssembly.Diagnostics.DevToolsProxy.Run(Uri browserUri, WebSocket ideSocket) in /_/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsProxy.cs:line 269

Instead, we use `Channel<T>` to add the ops, and then read those in
the main loop, and add to the *local* `pending_ops` list.

@thaystg
Copy link
Member Author

thaystg commented Oct 11, 2022

@radical can we backport it to 6?

@radical
Copy link
Member

radical commented Oct 11, 2022

At a cursory glance, yeah, it looks doable.

@thaystg
Copy link
Member Author

thaystg commented Oct 11, 2022

@lewing should we backport the correct and big fix? If the answer is yes I'll add this in my TODO list.

@carlossanlop carlossanlop changed the title [wasm][debugger] Avoid exception when calling WhenAny with a null parameter [release/6.0] [wasm][debugger] Avoid exception when calling WhenAny with a null parameter Oct 25, 2022
@carlossanlop
Copy link
Contributor

@thaysg should this go into main first, then get backported to 6.0?

@thaystg thaystg closed this Oct 25, 2022
@thaystg
Copy link
Member Author

thaystg commented Oct 25, 2022

@thaysg should this go into main first, then get backported to 6.0?

No, the code on main is completely different. I'll discuss with @lewing , but I closed the PR.

@thaystg thaystg deleted the thays_fix_68402 branch October 26, 2022 16:11
@ghost ghost locked as resolved and limited conversation to collaborators Nov 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants