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

[browser][MT] JSMarshalerArgument.ToJSContext crashes with "ContextHandle not set" #102749

Closed
akoeplinger opened this issue May 28, 2024 · 7 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript area-VM-threading-mono Known Build Error Use this to report build issues in the .NET Helix tab os-browser Browser variant of arch-wasm
Milestone

Comments

@akoeplinger
Copy link
Member

akoeplinger commented May 28, 2024

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=689247
Build error leg or test failing: WasmTestOnFirefox-MT-System.Text.Encoding.Extensions.Tests.WorkItemExecution
Pull request: #102744

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "InstallMainSynchronizationContext: Unexpected failure",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Log:

[09:44:15] info: Starting Firefox with args: Capabilities [BrowserName=firefox, Platform=Any, Version=]
1716889455076	geckodriver	INFO	Listening on 127.0.0.1:42167
1716889455203	mozrunner::runner	INFO	Running command: MOZ_CRASHREPORTER="1" MOZ_CRASHREPORTER_NO_REPORT="1" MOZ_CRASHREPORTER_SHUTDOWN="1" MOZ_NO_REMOTE="1" "/roo ... firefox" "--marionette" "-private-window" "--headless" "-private-window" "-no-remote" "-profile" "/tmp/rust_mozprofilevCQ03Q"
*** You are running in headless mode.
console.warn: services.settings: Ignoring preference override of remote settings server
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
[GFX1-]: glxtest: libpci missing
[GFX1-]: glxtest: libGL.so.1 missing
[GFX1-]: No GPUs detected via PCI

1716889456344	Marionette	INFO	Marionette enabled
console.error: "Warning: unrecognized command line flag" "-private-window"
1716889456416	Marionette	INFO	Listening on port 39015
Read port: 39015
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
console.error: ({})
[09:44:21] warn: [0x016b4b20-dpty 09:44:21.121] [MONO] Process terminated.
[09:44:21] warn: [0x016b4b20-dpty 09:44:21.133] [MONO] ContextHandle not set, ManagedThreadId: 1. 
                     at System.Environment.get_StackTrace()
                    at System.Runtime.InteropServices.JavaScript.JSMarshalerArgument.get_ToJSContext()
                    at System.Runtime.InteropServices.JavaScript.JavaScriptExports.InstallMainSynchronizationContext(JSMarshalerArgument* arguments_buffer)
[09:44:21] fail: 
[09:44:21] fail: "<unnamed thread>" tid=0xfb46c this=0x30804c0 , thread handle : 0x30e7a38, state : not waiting
[09:44:21] fail: 
[09:44:21] fail: 
[09:44:21] info: [0x000fb46c--UI- 09:44:21.135] MONO_WASM: Dumping web worker info as seen by UI thread, it could be stale:
[09:44:21] info: 000 | 0x000fb46c--UI-: isRunning: true isAttached: true isEventLoop:false reuseCount:  0 - UI Thread
[09:44:21] info: 001 | 0x016b4b20-dpty: isRunning: true isAttached: true isEventLoop:false reuseCount:  1 -
[09:44:21] info: 002 | 0x03386048--IO-: isRunning: true isAttached: true isEventLoop:false reuseCount:  1 -
[09:44:21] info: 003 | 0x0388e300-norm: isRunning: true isAttached: true isEventLoop:false reuseCount:  1 - Finalizer
[09:44:21] info: 004 |           -    : isRunning:false isAttached:false isEventLoop:false reuseCount:  0 - emscripten-pool
[09:44:21] info: 005 |           -    : isRunning:false isAttached:false isEventLoop:false reuseCount:  0 - emscripten-pool
[09:44:21] fail: 
[09:44:21] fail: "<unnamed thread>" tid=0x16b4b20 this=0x3080420 , thread handle : 0x1c8a2a0, state : not waiting
[09:44:21] fail:   at <unknown> <0xffffffff>
[09:44:21] fail:   at (wrapper managed-to-native) System.Environment.FailFast (string,System.Exception,string) [0x00000] in <781ebc365d6a490c8cee7d350b8165dc>:0
[09:44:21] fail:   at System.Environment.FailFast (string) [0x00000] in <781ebc365d6a490c8cee7d350b8165dc>:0
[09:44:21] fail:   at System.Runtime.InteropServices.JavaScript.JSMarshalerArgument.get_ToJSContext () [0x0000e] in <54ed45176146448eaacf7fe20af75376>:0
[09:44:21] fail:   at System.Runtime.InteropServices.JavaScript.JSMarshalerArgument.ToJS (System.Exception) [0x00131] in <54ed45176146448eaacf7fe20af75376>:0
[09:44:21] fail:   at System.Runtime.InteropServices.JavaScript.JavaScriptExports.InstallMainSynchronizationContext (System.Runtime.InteropServices.JavaScript.JSMarshalerArgument*) [0x00072] in <54ed45176146448eaacf7fe20af75376>:0
[09:44:21] fail:   at (wrapper runtime-invoke) <Module>.runtime_invoke_direct_void_JSMarshalerArgument* (object,intptr,intptr,intptr) [0x0002d] in <54ed45176146448eaacf7fe20af75376>:0
[09:44:21] fail:   at <unknown> <0x00000>
JavaScript error: http://127.0.0.1:38527/_framework/dotnet.native.js, line 8: uncaught exception: undefined
[09:44:21] fail: 
[09:44:21] fail: 
[09:44:21] info: WASM EXIT 1
[09:44:21] info: Waiting to flush log messages with a timeout of 120 secs ..
[09:44:21] fail: Application has finished with exit code TESTS_FAILED but 0 was expected
1716889461401	Marionette	INFO	Stopped listening on port 39015
XHarness exit code: 71 (GENERAL_FAILURE)

Known issue validation

Build: 🔎
Result validation: ⚠️ Provided build not found. Provide a valid build in the "Build: 🔎" line.
Validation performed at: 7/10/2024 9:07:14 AM UTC

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0
@akoeplinger akoeplinger added blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' area-System.Runtime.InteropServices.JavaScript Known Build Error Use this to report build issues in the .NET Helix tab os-browser Browser variant of arch-wasm labels May 28, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label May 28, 2024
@lewing lewing added this to the 9.0.0 milestone Jun 3, 2024
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Jun 3, 2024
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture and removed area-VM-threading-mono labels Jul 9, 2024
@pavelsavara pavelsavara self-assigned this Jul 9, 2024
@pavelsavara
Copy link
Member

I improved exception handling and now it will abort with InstallMainSynchronizationContext: Unexpected failure
I updated the filter here

@pavelsavara
Copy link
Member

pavelsavara commented Jul 22, 2024

Could not load file or assembly System.Threading

Log

System.TypeLoadException: Could not find method '.ctor' due to a type load error: Could not load type of field 'System.Threading.Channels.AsyncOperation`1[TResult]:_executionContext' (9) due to: Could not load file or assembly 'System.Threading, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:System.Threading.Channels.dll type:AsyncOperation`1 member:(null)
                    at System.Threading.Channels.SingleConsumerUnboundedChannel`1[[System.Runtime.InteropServices.JavaScript.JSSynchronizationContext.WorkItem, System.Runtime.InteropServices.JavaScript, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]..ctor(Boolean runContinuationsAsynchronously)
                    at System.Threading.Channels.Channel.CreateUnbounded[WorkItem](UnboundedChannelOptions options)
                    at System.Runtime.InteropServices.JavaScript.JSSynchronizationContext..ctor(Boolean isMainThread, CancellationToken cancellationToken)
                    at System.Runtime.InteropServices.JavaScript.JSSynchronizationContext.InstallWebWorkerInterop(Boolean isMainThread, CancellationToken cancellationToken)
                    at System.Runtime.InteropServices.JavaScript.JavaScriptExports.InstallMainSynchronizationContext(JSMarshalerArgument* arguments_buffer)

@maraf maraf removed the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label Jul 29, 2024
@pavelsavara
Copy link
Member

#105244 probably fixed it

@akoeplinger
Copy link
Member Author

akoeplinger commented Jul 29, 2024

@pavelsavara I've also seen this, is that the same issue? from https://github.com/dotnet/runtime/runs/28055366557

[14:30:37] info: Initializing dotnet version 9.0.0-ci commit hash c09c7908bffb16581624bc2de4e731f491fafc06
[14:30:37] info: [0x000fbae8--UI- 14:30:37.936] MONO_WASM: Dumping web worker info as seen by UI thread, it could be stale:
[14:30:37] info: 000 | 0x000fbae8--UI-: isRunning: true isAttached: true isEventLoop:false reuseCount:  0 - UI Thread
[14:30:37] info: 001 | 0x0124fcd8-dpty: isRunning: true isAttached: true isEventLoop:false reuseCount:  1 -
[14:30:37] info: 002 | 0x03290020--IO-: isRunning: true isAttached: true isEventLoop:false reuseCount:  1 -
[14:30:37] info: 003 | 0x037982d8-norm: isRunning: true isAttached: true isEventLoop:false reuseCount:  1 - Finalizer
[14:30:37] info: 004 | 0x0401cd50-pool: isRunning: true isAttached: true isEventLoop:false reuseCount:  1 - .NET TP Worker
[14:30:37] info: 005 | 0x04638030-gate: isRunning: true isAttached: true isEventLoop:false reuseCount:  1 - .NET TP Gate
[14:30:37] info: 006 |           -    : isRunning:false isAttached:false isEventLoop:false reuseCount:  0 - emscripten-pool
[14:30:37] fail: [0x000fbae8--UI- 14:30:37.974] MONO_WASM: Could not load type of field 'System.Console:s_sigIntRegistration' (9) due to: Could not load file or assembly 'System.Runtime.InteropServices, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
                    at WasmTestRunner.RunAsync()
                    at Microsoft.DotNet.XHarness.TestRunners.Xunit.WasmApplicationEntryPoint.Run()
                    at WasmTestRunner.Main(String[] args)
                 ManagedError@http://127.0.0.1:40679/_framework/dotnet.runtime.js:3:37234
                 an@http://127.0.0.1:40679/_framework/dotnet.runtime.js:3:27033
                 on/<@http://127.0.0.1:40679/_framework/dotnet.runtime.js:3:26589
                 Dl</</<@http://127.0.0.1:40679/_framework/dotnet.runtime.js:3:198011
                 Dl</<@http://127.0.0.1:40679/_framework/dotnet.runtime.js:3:198139
                 callUserCallback@http://127.0.0.1:40679/_framework/dotnet.native.js:8:98666
                 createDotnetRuntime/safeSetTimeout/createDotnetRuntime<@http://127.0.0.1:40679/_framework/dotnet.native.js:8:106269
JavaScript error: http://127.0.0.1:40679/_framework/dotnet.runtime.js, line 3: Error: Could not load type of field 'System.Console:s_sigIntRegistration' (9) due to: Could not load file or assembly 'System.Runtime.InteropServices, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
[14:30:38] info: WASM EXIT 1

@pavelsavara
Copy link
Member

pavelsavara commented Jul 30, 2024

@akoeplinger Could you please link the full log ?
It seems to me that the runtime itself should not depend on System.Console.wasm and so it should not be the same issue.

@pavelsavara I've also seen this, is that the same issue?
Could not load type of field 'System.Console:s_sigIntRegistration' (9) due to:
Could not load file or assembly 'System.Runtime.InteropServices, Version=9.0.0.0, Culture=neutral,

@lewing lewing modified the milestones: 9.0.0, 10.0.0 Jul 30, 2024
@pavelsavara
Copy link
Member

@pavelsavara I've also seen this, is that the same issue? from https://github.com/dotnet/runtime/runs/28055366557

Filled #106067

@ilonatommy
Copy link
Member

#105244 probably fixed it

looks like it's true:

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0

@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript area-VM-threading-mono Known Build Error Use this to report build issues in the .NET Helix tab os-browser Browser variant of arch-wasm
Projects
None yet
Development

No branches or pull requests

5 participants