From 33b5c4a0f65adf1740ece58381b300e15f0757ed Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 27 Mar 2023 22:49:07 +0200 Subject: [PATCH 01/10] [wasm] Bump emscripten to 3.1.34 --- src/mono/wasm/emscripten-version.txt | 2 +- src/mono/wasm/wasm.proj | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mono/wasm/emscripten-version.txt b/src/mono/wasm/emscripten-version.txt index f4e47c2e5e20a5..45dd3925308664 100644 --- a/src/mono/wasm/emscripten-version.txt +++ b/src/mono/wasm/emscripten-version.txt @@ -1 +1 @@ -3.1.30 \ No newline at end of file +3.1.34 \ No newline at end of file diff --git a/src/mono/wasm/wasm.proj b/src/mono/wasm/wasm.proj index 9755e405afed42..8342ee12786ebb 100644 --- a/src/mono/wasm/wasm.proj +++ b/src/mono/wasm/wasm.proj @@ -293,7 +293,6 @@ <_EmccLinkFlags Include="-s EXPORTED_RUNTIME_METHODS=$(_EmccExportedRuntimeMethods)" /> <_EmccLinkFlags Include="-s EXPORTED_FUNCTIONS=$(_EmccExportedFunctions)" /> <_EmccLinkFlags Include="--source-map-base http://example.com" /> - <_EmccLinkFlags Include="-s STRICT_JS=1" /> <_EmccLinkFlags Include="-s WASM_BIGINT=1" /> <_EmccLinkFlags Include="-s EXPORT_NAME="'createDotnetRuntime'"" /> <_EmccLinkFlags Include="-s MODULARIZE=1"/> From dff44d4ff438a811f9c60532dd7fb7d83b6a62d0 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 27 Mar 2023 22:53:30 +0200 Subject: [PATCH 02/10] Update emsdk deps --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8570eb65ca9f59..28a624fa653bb6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -85,9 +85,9 @@ f32e148d67dbf348685c3076a37e8bc68ab3a30f - + https://github.com/dotnet/emsdk - a464820353b7956538b07c9b53103d793b5e15b6 + e4089ed2abe29bdc25bab2c261940175d0846824 diff --git a/eng/Versions.props b/eng/Versions.props index a73f7cb7138431..ff97380e6cae2f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -241,7 +241,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-8_0_100_Transport --> - 8.0.0-preview.4.23170.1 + 8.0.0-preview.4.23177.1 $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion) 1.1.87-gba258badda From ce1a265a4ce87a4d0a575ecb6e64618c815638f5 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 27 Mar 2023 22:56:13 +0200 Subject: [PATCH 03/10] Update icu deps --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 28a624fa653bb6..42bd8bb7e56664 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/icu - b3cb54fec4eb845b37038c934d6c9dc17cdfb181 + 389d19d09d3cf16ec0143dba065fcd704ab8e48c https://github.com/dotnet/msquic diff --git a/eng/Versions.props b/eng/Versions.props index ff97380e6cae2f..9b268b6d877a51 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -222,7 +222,7 @@ 0.11.4-alpha.23163.1 - 8.0.0-preview.3.23163.3 + 8.0.0-preview.4.23177.3 2.1.7 8.0.0-alpha.1.23166.1 From ed96a04bd686d6fcbf02318062a26bcce7e21c0f Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 27 Mar 2023 23:00:14 +0200 Subject: [PATCH 04/10] Use new images --- eng/pipelines/common/templates/pipeline-with-resources.yml | 4 ++-- eng/pipelines/libraries/helix-queues-setup.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/common/templates/pipeline-with-resources.yml b/eng/pipelines/common/templates/pipeline-with-resources.yml index e849da704781cb..e5c710bd7b8216 100644 --- a/eng/pipelines/common/templates/pipeline-with-resources.yml +++ b/eng/pipelines/common/templates/pipeline-with-resources.yml @@ -60,10 +60,10 @@ resources: ROOTFS_DIR: /crossrootfs/ppc64le - container: browser_wasm - image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-webassembly-net8 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-webassembly-net8-20230327150025-4404b5c - container: wasi_wasm - image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-webassembly-net8 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-webassembly-net8-20230327150037-4404b5c - container: freebsd_x64 image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-freebsd-12 diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index 41e1eb4207fbe9..6c6837a74938ac 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -201,6 +201,6 @@ jobs: # Browser WebAssembly windows - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win') }}: - - (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly-net8 + - (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly-net8-20230327150108-4404b5c ${{ insert }}: ${{ parameters.jobParameters }} From 8e6a28ccdb6fa820c481cf63c561ed3854208ef4 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 27 Mar 2023 23:26:46 +0200 Subject: [PATCH 05/10] Use emscripten_main_runtime_thread_id --- src/mono/mono/utils/mono-threads-wasm.c | 2 +- src/mono/wasm/runtime/pthreads/shared/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/utils/mono-threads-wasm.c b/src/mono/mono/utils/mono-threads-wasm.c index 74cc69825f29fa..96e5446388a43a 100644 --- a/src/mono/mono/utils/mono-threads-wasm.c +++ b/src/mono/mono/utils/mono-threads-wasm.c @@ -403,7 +403,7 @@ mono_threads_wasm_browser_thread_tid (void) #ifdef DISABLE_THREADS return (MonoNativeThreadId)1; #else - return (MonoNativeThreadId)emscripten_main_browser_thread_id (); + return (MonoNativeThreadId)emscripten_main_runtime_thread_id (); #endif } diff --git a/src/mono/wasm/runtime/pthreads/shared/index.ts b/src/mono/wasm/runtime/pthreads/shared/index.ts index c71a27f5f3967d..774dbc76ec8af4 100644 --- a/src/mono/wasm/runtime/pthreads/shared/index.ts +++ b/src/mono/wasm/runtime/pthreads/shared/index.ts @@ -20,7 +20,7 @@ export const MainThread: PThreadInfo = { let browser_thread_id_lazy: pthread_ptr | undefined; export function getBrowserThreadID(): pthread_ptr { if (browser_thread_id_lazy === undefined) { - browser_thread_id_lazy = (Module)["_emscripten_main_browser_thread_id"]() as pthread_ptr; + browser_thread_id_lazy = (Module)["_emscripten_main_runtime_thread_id"]() as pthread_ptr; } return browser_thread_id_lazy; } From 81672f4243de7e3b0dba7f744ceb3945f1328352 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Tue, 28 Mar 2023 13:54:27 +0200 Subject: [PATCH 06/10] Ignore ExitStatus exceptions This should fix these errors: [wasm test] [23:10:04] dbug: Reached wasm exit [wasm test] [23:10:04] info: node:internal/process/promises:246 [wasm test] [23:10:04] info: triggerUncaughtException(err, true /* fromPromise */); [wasm test] [23:10:04] info: ^ [wasm test] [23:10:04] info: [wasm test] [23:10:04] info: [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#".] { [wasm test] [23:10:04] info: code: 'ERR_UNHANDLED_REJECTION' [wasm test] [23:10:04] info: } [wasm test] [23:10:04] info: [wasm test] [23:10:04] info: Node.js v17.3.1 [wasm test] [23:10:04] info: Process node.exe exited with 1 --- src/mono/wasm/test-main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mono/wasm/test-main.js b/src/mono/wasm/test-main.js index 60c54734929629..9de965c3f5f629 100644 --- a/src/mono/wasm/test-main.js +++ b/src/mono/wasm/test-main.js @@ -23,6 +23,16 @@ if (is_node && process.versions.node.split(".")[0] < 14) { throw new Error(`NodeJS at '${process.execPath}' has too low version '${process.versions.node}'`); } +if (is_node) { + // the emscripten 3.1.34 stopped handling these when MODULARIZE is enabled + process.on('uncaughtException', function(ex) { + // ignore ExitStatus exceptions + if (ex !== 'unwind' && !(ex instanceof ExitStatus) && !(ex.context instanceof ExitStatus)) { + throw ex; + } + }); +} + if (!is_node && !is_browser && typeof globalThis.crypto === 'undefined') { // **NOTE** this is a simple insecure polyfill for testing purposes only // /dev/random doesn't work on js shells, so define our own From c2cbb94edd4b4f67542603edc3c6d67180bb51f2 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Tue, 28 Mar 2023 20:44:06 +0200 Subject: [PATCH 07/10] Handle UnhandledPromiseRejection for ExitStatus --- src/mono/wasm/Wasm.Build.Tests/data/test-main-7.0.js | 10 ++++++++++ src/mono/wasm/test-main.js | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/data/test-main-7.0.js b/src/mono/wasm/Wasm.Build.Tests/data/test-main-7.0.js index bac3f856160c57..3b32add2f39e57 100644 --- a/src/mono/wasm/Wasm.Build.Tests/data/test-main-7.0.js +++ b/src/mono/wasm/Wasm.Build.Tests/data/test-main-7.0.js @@ -23,6 +23,16 @@ if (is_node && process.versions.node.split(".")[0] < 14) { throw new Error(`NodeJS at '${process.execPath}' has too low version '${process.versions.node}'`); } +if (is_node) { + // the emscripten 3.1.34 stopped handling these when MODULARIZE is enabled + process.on('uncaughtException', function(ex) { + // ignore UnhandledPromiseRejection exceptions with exit status + if (ex !== 'unwind' && (ex.name !== "UnhandledPromiseRejection" || !ex.message.includes('"#"'))) { + throw ex; + } + }); +} + if (typeof globalThis.crypto === 'undefined') { // **NOTE** this is a simple insecure polyfill for testing purposes only // /dev/random doesn't work on js shells, so define our own diff --git a/src/mono/wasm/test-main.js b/src/mono/wasm/test-main.js index 9de965c3f5f629..3d835c0bb61407 100644 --- a/src/mono/wasm/test-main.js +++ b/src/mono/wasm/test-main.js @@ -26,8 +26,8 @@ if (is_node && process.versions.node.split(".")[0] < 14) { if (is_node) { // the emscripten 3.1.34 stopped handling these when MODULARIZE is enabled process.on('uncaughtException', function(ex) { - // ignore ExitStatus exceptions - if (ex !== 'unwind' && !(ex instanceof ExitStatus) && !(ex.context instanceof ExitStatus)) { + // ignore UnhandledPromiseRejection exceptions with exit status + if (ex !== 'unwind' && (ex.name !== "UnhandledPromiseRejection" || !ex.message.includes('"#"'))) { throw ex; } }); From 2097f47def5bf0a4d142c5debf6cadd8621e2697 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Thu, 13 Apr 2023 18:49:46 +0200 Subject: [PATCH 08/10] Exclude 2 failing tests --- src/tests/issues.targets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 8109a6eff33700..3ba43cf26ca945 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -3694,6 +3694,12 @@ https://github.com/dotnet/runtime/issues/41472 + + https://github.com/dotnet/runtime/issues/84786 + + + https://github.com/dotnet/runtime/issues/84786 + needs triage From ad92e213c38b339d4ab685c91880d355190334ba Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Fri, 14 Apr 2023 14:06:30 +0200 Subject: [PATCH 09/10] Updade ICU deps --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cee8fd88e8b079..8622066063327c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/icu - 389d19d09d3cf16ec0143dba065fcd704ab8e48c + 89d559f979bd4253485b0feb73919c7c088cac7d https://github.com/dotnet/msquic diff --git a/eng/Versions.props b/eng/Versions.props index 394c175cd8444c..81906e08d49c31 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -217,7 +217,7 @@ 0.11.4-alpha.23178.1 - 8.0.0-preview.4.23177.3 + 8.0.0-preview.4.23212.1 2.1.7 8.0.0-alpha.1.23180.2 From 556fc6ea70df4d6fe46255932cb90cf73c2e4c96 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Fri, 14 Apr 2023 14:23:19 +0200 Subject: [PATCH 10/10] Revert "Updade ICU deps" This reverts commit ad92e213c38b339d4ab685c91880d355190334ba. Looks like main is behind and doesn't work with latest ICU, so go back to the one with 3.1.34 bump --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8622066063327c..cee8fd88e8b079 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/icu - 89d559f979bd4253485b0feb73919c7c088cac7d + 389d19d09d3cf16ec0143dba065fcd704ab8e48c https://github.com/dotnet/msquic diff --git a/eng/Versions.props b/eng/Versions.props index 81906e08d49c31..394c175cd8444c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -217,7 +217,7 @@ 0.11.4-alpha.23178.1 - 8.0.0-preview.4.23212.1 + 8.0.0-preview.4.23177.3 2.1.7 8.0.0-alpha.1.23180.2