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

[ci] Fix Playwright test times out/fails because target closed #100074

Merged
merged 15 commits into from
Mar 28, 2024

Conversation

ilonatommy
Copy link
Member

@ilonatommy ilonatommy commented Mar 21, 2024

Fixes #99961, #100307.

  1. I made a mistake in the last fix - we changed OnInitialized to OnAfterRender but we kept OnPageLoaded to trigger the test, instead of waiting for OnAfterRender to finish to make sure all buttons are loaded. Most of the times it worked fine but it was not reliable.
  2. We were entering OnAfterRender multiple times and triggering the event chain even more than 10 times in one test, some of these connections already finished and closed the app, the others were in process and failed with error. Now we make sure we trigger it only once.

@ilonatommy ilonatommy added the arch-wasm WebAssembly architecture label Mar 21, 2024
@ilonatommy ilonatommy requested a review from pavelsavara March 21, 2024 12:48
@ilonatommy ilonatommy self-assigned this Mar 21, 2024
@ilonatommy ilonatommy requested a review from maraf as a code owner March 21, 2024 12:48
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

@ilonatommy ilonatommy added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Mar 21, 2024
@ilonatommy
Copy link
Member Author

ilonatommy commented Mar 22, 2024

Blocker:

The test occasionally times out. The last log is [info] Debugging hotkey: Shift+Alt+D (when application has focus) and OnAfterRender is never triggered. In debug runtime the problem is hit in each run:

// from local run
[log] Program.cs start
  �[m�[37m        [debug] MONO_WASM: preInitWorker
  �[m�[37m        [debug] MONO_WASM: mono_wasm_pre_init_essential
  �[m�[37m        [debug] [0x000f3c7c--UI-] MONO_WASM: Binding [JSImport] Blazor._internal.navigationManager.getBaseURI from blazor-internal module
  �[m�[37m        [debug] [0x000f3c7c--UI-] MONO_WASM: Binding [JSImport] Blazor._internal.navigationManager.getLocationHref from blazor-internal module
  �[m�[37m        [debug] [0x000f3c7c--UI-] MONO_WASM: Binding [JSImport] Blazor._internal.registeredComponents.getRegisteredComponentsCount from blazor-internal module
  �[m�[37m        [debug] [0x000f3c7c--UI-] MONO_WASM: Binding [JSImport] Blazor._internal.getPersistedState from blazor-internal module
  �[m�[37m        [debug] [0x000f3c7c--UI-] MONO_WASM: Binding [JSImport] Blazor._internal.getApplicationEnvironment from blazor-internal module
  �[m�[37m        [log] Program.cs builder created
  �[m�[37m        [log] Building the host...
  �[m�[37m        [log] Running the host...
  �[m�[37m        [debug] [0x000f3c7c--UI-] MONO_WASM: Binding [JSImport] INTERNAL.loadSatelliteAssemblies from null module
  �[m�[37m        [warning] [MONO] Process terminated.
  �[m�[37m        [warning] [MONO] Marshalling null return Task to JS is not supported in MT
  �[m�[37m        [warning] Aborted(native code called abort())
  �[m�[37m        [warning] user callback triggered after runtime exited or application aborted.  Ignoring.
  �[m�[37m        [ERROR] PageError: RuntimeError: Aborted(native code called abort())
  �[m�[37m            at abort (http://localhost:5000/_framework/dotnet.native.9.0.0-dev.ude7sa5nfp.js:726:10)
  �[m�[37m            at _abort (http://localhost:5000/_framework/dotnet.native.9.0.0-dev.ude7sa5nfp.js:5639:2)
  �[m�[37m            at ves_icall_System_Environment_FailFast (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[4014]:0x122d9b)
  �[m�[37m            at ves_icall_System_Environment_FailFast_raw (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[4086]:0x125f0f)
  �[m�[37m            at do_icall (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[363]:0x2aa5e)
  �[m�[37m            at do_icall_wrapper (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[283]:0x274f8)
  �[m�[37m            at mono_interp_exec_method (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[274]:0x15dee)
  �[m�[37m            at interp_runtime_invoke (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[317]:0x28901)
  �[m�[37m            at mono_jit_runtime_invoke (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[7375]:0x1cfd88)
  �[m�[37m            at do_runtime_invoke (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[5310]:0x167123)
  �[m�[37m        [debug] MONO_WASM: Program terminated with exit(1)
  �[m�[37m        Error
  �[m�[37m            at mono_exit (http://localhost:5000/_framework/dotnet.js:1959:24)
  �[m�[37m            at Object.onAbort (http://localhost:5000/_framework/dotnet.js:1931:5)
  �[m�[37m            at worker.onmessage (http://localhost:5000/_framework/dotnet.native.9.0.0-dev.ude7sa5nfp.js:3612:25)
  �[m�[37m        [info] WASM EXIT 1
  �[m�[37m        [ERROR] PageError: : ExitStatus
  �[m�[37m        [warning] Pthread 0x01d37d78 sent an error! http://localhost:5000/_framework/dotnet.native.worker.9.0.0-dev.acgs8mglmz.js:93: Uncaught RuntimeError: Aborted(native code called abort())
  �[m�[37m        [ERROR] PageError: : ErrorEvent
  �[m�[37m        [info] [0x000f3c7c--UI-] MONO_WASM: UI thread is alive!
  �[m�[37m        [info] [0x000f3c7c--UI-] MONO_WASM: UI thread is alive!

from CI log:

[info] Debugging hotkey: Shift+Alt+D (when application has focus)
[log] Program.cs start
[log] Program.cs builder created
TestOutput -> Chat component constructor called
[log] TestOutput -> OnInitialized
TestOutput -> OnInitialized
[log] TestOutput -> OnParametersSet
TestOutput -> OnParametersSet
[debug] dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 6 of type BlazorHosted.Client.Pages.Chat
[log] TestOutput -> OnAfterRender firstRender = True
....
dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 11 of type Microsoft.AspNetCore.Components.Sections.SectionOutlet+SectionOutletContentRenderer
[debug] dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[5]
      Handling event 1 of type 'MouseEventArgs'
[log] TestOutput -> ShouldRender = True
TestOutput -> ShouldRender = True
[debug] dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 6 of type BlazorHosted.Client.Pages.Chat
[ERROR] PageError: RuntimeError: memory access out of bounds
    at http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[8788]:0x21ef65
    at http://localhost:5000/_framework/dotnet.runtime.9.0.0-ci.ooy53j55dw.js:3:43188
    at v (http://localhost:5000/_framework/dotnet.runtime.9.0.0-ci.ooy53j55dw.js:3:222380)
    at http://localhost:5000/_framework/dotnet.runtime.9.0.0-ci.ooy53j55dw.js:3:223529
    at http://localhost:5000/_framework/dotnet.runtime.9.0.0-ci.ooy53j55dw.js:3:44879
    at callUserCallback (http://localhost:5000/_framework/dotnet.native.9.0.0-ci.6ezff52hgm.js:8:102608)
    at http://localhost:5000/_framework/dotnet.native.9.0.0-ci.6ezff52hgm.js:8:111163

Another error type:

[warning] [--000f3c2c-emsc] MONO_WASM: Failed to find unused WebWorker, this may deadlock. Please increase the pthreadPoolReady. Running threads 0. Loading workers: 0
  �[m�[37m        [debug] MONO_WASM: mono config received
  �[m�[37m        [debug] MONO_WASM: Attempting to import 'http://localhost:5000/_framework/dotnet.runtime.9.0.0-dev.ip7c6tnva1.js' for dotnet.runtime.9.0.0-dev.ip7c6tnva1.js
  �[m�[37m        [debug] MONO_WASM: Attempting to import 'http://localhost:5000/_framework/dotnet.native.9.0.0-dev.ude7sa5nfp.js' for dotnet.native.9.0.0-dev.ude7sa5nfp.js
  �[m�[37m        [debug] MONO_WASM: mono_download_assets
  �[m�[37m        [debug] MONO_WASM: preInitWorker
  �[m�[37m        [debug] MONO_WASM: mono_wasm_pre_init_essential
  �[m�[37m        [error] Pthread 0x1d380c0 completed its main entry point with an `unwind`, keeping the worker alive for asynchronous operation.
  �[m�[37m        [debug] [--01d380c0-emsc] MONO_WASM: Initializing mono runtime
  �[m�[37m        [debug] [--01d380c0-emsc] MONO_WASM: mono_wasm_load_runtime
  �[m�[37m        [debug] [0x01d380c0-dpty] MONO_WASM: bindings_init
  �[m�[37m        [debug] MONO_WASM: abort_startup, reason: [object Object]
  �[m�[37m        [debug] MONO_WASM: Program terminated with exit(1)
  �[m�[37m        Error
  �[m�[37m            at mono_exit (http://localhost:5000/_framework/dotnet.js:1959:24)
  �[m�[37m            at Object.onAbort (http://localhost:5000/_framework/dotnet.js:1931:5)
  �[m�[37m            at abort (http://localhost:5000/_framework/dotnet.native.9.0.0-dev.ude7sa5nfp.js:720:20)
  �[m�[37m            at assert (http://localhost:5000/_framework/dotnet.native.9.0.0-dev.ude7sa5nfp.js:368:3)
  �[m�[37m            at spawnThread (http://localhost:5000/_framework/dotnet.native.9.0.0-dev.ude7sa5nfp.js:1012:2)
  �[m�[37m            at ___pthread_create_js (http://localhost:5000/_framework/dotnet.native.9.0.0-dev.ude7sa5nfp.js:4002:9)
  �[m�[37m            at __pthread_create (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[15833]:0x32b0fb)
  �[m�[37m            at mono_wasm_create_io_thread (http://localhost:5000/_framework/dotnet.native.wasm:wasm-function[1273]:0x6db6c)
  �[m�[37m            at wf.<computed> (http://localhost:5000/_framework/dotnet.runtime.9.0.0-dev.ip7c6tnva1.js:180:24)
  �[m�[37m            at onRuntimeInitializedAsync (http://localhost:5000/_framework/dotnet.runtime.9.0.0-dev.ip7c6tnva1.js:18160:66)
  �[m�[37m        [info] WASM EXIT 1
  �[m�[37m        [ERROR] PageError: : ExitStatus

@ilonatommy
Copy link
Member Author

ilonatommy commented Mar 27, 2024

It does not fail anymore with the error from the original issues. Failure is not connected.

@ilonatommy ilonatommy merged commit e203933 into dotnet:main Mar 28, 2024
20 of 22 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ci] Playwright test times out/fails because target closed
2 participants