Skip to content

Commit

Permalink
[wasm] Bump emscripten to 3.1.34 (#83998)
Browse files Browse the repository at this point in the history
* [wasm] Bump emscripten to 3.1.34

* Update emsdk deps

* Update icu deps

* Use new images

* Use emscripten_main_runtime_thread_id

* 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 "#<ExitStatus>".] {
    [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

* Handle UnhandledPromiseRejection for ExitStatus

* Exclude 2 failing tests

* Updade ICU deps

* Revert "Updade ICU deps"

This reverts commit ad92e21.

Looks like main is behind and doesn't work with latest ICU, so go back
to the one with 3.1.34 bump
  • Loading branch information
radekdoulik authored Apr 17, 2023
1 parent 636682c commit dbd4233
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 12 deletions.
6 changes: 3 additions & 3 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.NETCore.Runtime.ICU.Transport" Version="8.0.0-preview.4.23203.1">
<Dependency Name="Microsoft.NETCore.Runtime.ICU.Transport" Version="8.0.0-preview.4.23177.3">
<Uri>https://github.com/dotnet/icu</Uri>
<Sha>389d19d09d3cf16ec0143dba065fcd704ab8e48c</Sha>
</Dependency>
Expand Down Expand Up @@ -85,9 +85,9 @@
<Sha>9a7551fa7ba8218affbc1148eabc4b5c9f4e1151</Sha>
<SourceBuild RepoName="cecil" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport" Version="8.0.0-preview.4.23205.3">
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport" Version="8.0.0-preview.4.23177.1">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>07ca08d31022f545d37fbc8d1254d3441645fce2</Sha>
<Sha>e4089ed2abe29bdc25bab2c261940175d0846824</Sha>
<SourceBuild RepoName="emsdk" ManagedOnly="true" />
</Dependency>
</ProductDependencies>
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
<!-- Mono Cecil -->
<MicrosoftDotNetCecilVersion>0.11.4-alpha.23178.1</MicrosoftDotNetCecilVersion>
<!-- ICU -->
<MicrosoftNETCoreRuntimeICUTransportVersion>8.0.0-preview.4.23203.1</MicrosoftNETCoreRuntimeICUTransportVersion>
<MicrosoftNETCoreRuntimeICUTransportVersion>8.0.0-preview.4.23177.3</MicrosoftNETCoreRuntimeICUTransportVersion>
<!-- MsQuic -->
<MicrosoftNativeQuicMsQuicVersion>2.1.7</MicrosoftNativeQuicMsQuicVersion>
<SystemNetMsQuicTransportVersion>8.0.0-alpha.1.23180.2</SystemNetMsQuicTransportVersion>
Expand All @@ -236,7 +236,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
-->
<MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>8.0.0-preview.4.23205.3</MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>8.0.0-preview.4.23177.1</MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>
<MicrosoftNETRuntimeEmscriptenVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion)</MicrosoftNETRuntimeEmscriptenVersion>
<!-- workloads -->
<SwixPackageVersion>1.1.87-gba258badda</SwixPackageVersion>
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/common/templates/pipeline-with-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ resources:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7

- container: browser_wasm
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-webassembly-net8-20230322221728-80fdceb
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-20230322221804-80fdceb
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
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/libraries/helix-queues-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,6 @@ jobs:

# Browser WebAssembly windows
- ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win') }}:
- (Windows.Amd64.Server2022.Open)[email protected]/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly-net8-20230319084205-80fdceb
- (Windows.Amd64.Server2022.Open)[email protected]/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly-net8-20230327150108-4404b5c

${{ insert }}: ${{ parameters.jobParameters }}
2 changes: 1 addition & 1 deletion src/mono/mono/utils/mono-threads-wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
10 changes: 10 additions & 0 deletions src/mono/wasm/Wasm.Build.Tests/data/test-main-7.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('"#<ExitStatus>"'))) {
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
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/emscripten-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.30
3.1.34
2 changes: 1 addition & 1 deletion src/mono/wasm/runtime/pthreads/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (<any>Module)["_emscripten_main_browser_thread_id"]() as pthread_ptr;
browser_thread_id_lazy = (<any>Module)["_emscripten_main_runtime_thread_id"]() as pthread_ptr;
}
return browser_thread_id_lazy;
}
Expand Down
10 changes: 10 additions & 0 deletions src/mono/wasm/test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('"#<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
Expand Down
1 change: 0 additions & 1 deletion src/mono/wasm/wasm.proj
Original file line number Diff line number Diff line change
Expand Up @@ -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=&quot;'createDotnetRuntime'&quot;" />
<_EmccLinkFlags Include="-s MODULARIZE=1"/>
Expand Down
6 changes: 6 additions & 0 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3704,6 +3704,12 @@
<ExcludeList Include = "$(XunitTestBinBase)/JIT/Performance/CodeQuality/BenchmarksGame/mandelbrot/mandelbrot-7/**">
<Issue>https://github.com/dotnet/runtime/issues/41472</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/GC/API/GCHandleCollector/Usage/**">
<Issue>https://github.com/dotnet/runtime/issues/84786</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/tracing/eventcounter/regression-25709/**">
<Issue>https://github.com/dotnet/runtime/issues/84786</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/GC/Regressions/v2.0-beta2/452950/452950/**">
<Issue>needs triage</Issue>
</ExcludeList>
Expand Down

0 comments on commit dbd4233

Please sign in to comment.