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] send cancel to abandoned threads with event loop during mono_exit #97441

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7b829f9
- `cancelThreads` will exit all JSWebWorker which are still running (…
pavelsavara Jan 24, 2024
875eae2
don't load snapshot on threads
pavelsavara Jan 24, 2024
52483a4
- only register runtime into globalThis when it's ready started
pavelsavara Jan 24, 2024
3d27902
Merge branch 'main' into browser_abandoned_jswebworker_timeout
pavelsavara Jan 24, 2024
0a3a1a8
more MT smoke tests
pavelsavara Jan 24, 2024
a55dd62
improve thread prefix logging
pavelsavara Jan 25, 2024
f2354af
more
pavelsavara Jan 25, 2024
d090b37
fix
pavelsavara Jan 25, 2024
21e6f20
Merge branch 'main' into browser_abandoned_jswebworker_timeout
pavelsavara Jan 25, 2024
834b001
more
pavelsavara Jan 25, 2024
b46712f
Update src/mono/browser/runtime/pthreads/browser/index.ts
pavelsavara Jan 25, 2024
8b05ab9
feedback
pavelsavara Jan 25, 2024
7189c02
fix
pavelsavara Jan 25, 2024
3db3f68
Merge branch 'main' into browser_abandoned_jswebworker_timeout
pavelsavara Jan 25, 2024
298013d
Merge branch 'main' into browser_abandoned_jswebworker_timeout
pavelsavara Jan 25, 2024
32266cb
Merge branch 'main' into browser_abandoned_jswebworker_timeout
pavelsavara Jan 26, 2024
8e19831
ts cleanup
pavelsavara Jan 26, 2024
366732e
registration feedback
pavelsavara Jan 26, 2024
5cdf123
split test
pavelsavara Jan 26, 2024
cf0ee2f
split
pavelsavara Jan 26, 2024
82a549c
more
pavelsavara Jan 26, 2024
fed4ff3
more
pavelsavara Jan 26, 2024
63df065
thread events
pavelsavara Jan 28, 2024
8069389
more cache logging
pavelsavara Jan 28, 2024
fefe471
fix
pavelsavara Jan 28, 2024
2d434a7
Merge branch 'main' into browser_abandoned_jswebworker_timeout
pavelsavara Jan 29, 2024
a99547f
fix snapshot hash
pavelsavara Jan 29, 2024
902f173
fix
pavelsavara Jan 29, 2024
988cee6
Update src/mono/browser/runtime/interp-pgo.ts
pavelsavara Jan 29, 2024
d025490
feedback
pavelsavara Jan 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static async Task<int> Main(string[] args)
var includedClasses = new List<string>();
var includedMethods = new List<string>();
var backgroundExec = false;
var untilFailed = false;

for (int i = 1; i < args.Length; i++)
{
Expand Down Expand Up @@ -53,6 +54,9 @@ public static async Task<int> Main(string[] args)
case "-backgroundExec":
backgroundExec = true;
break;
case "-untilFailed":
untilFailed = true;
break;
default:
throw new ArgumentException($"Invalid argument '{option}'.");
}
Expand All @@ -72,10 +76,21 @@ public static async Task<int> Main(string[] args)
{
await Task.Yield();
}
if (backgroundExec)

var res = 0;
do
{
return await Task.Run(() => runner.Run());
if (backgroundExec)
{
res = await Task.Run(() => runner.Run());
}
else
{
res = await runner.Run();
}
}
return await runner.Run();
while(res == 0 && untilFailed);

return res;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ private void Dispose(bool disposing)
{
_cancellationRegistration?.Dispose();
_cancellationRegistration = null;
_thread?.Join(50);
}

if (_jsSynchronizationContext != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
<!-- Make debugging easier -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<WasmNativeStrip>false</WasmNativeStrip>
<WasmXHarnessMonoArgs>$(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true</WasmXHarnessMonoArgs>
</PropertyGroup>
<ItemGroup>
<Compile Include="System\Runtime\InteropServices\JavaScript\JavaScriptTestHelper.cs" />
<Compile Include="System\Runtime\InteropServices\JavaScript\JSImportExportTest.cs" />
<Compile Include="System\Runtime\InteropServices\JavaScript\SecondRuntimeTest.cs" />
<Compile Include="System\Runtime\InteropServices\JavaScript\HttpRequestMessageTest.cs" />
<Compile Include="System\Runtime\InteropServices\JavaScript\TimerTests.cs" />
<Compile Include="System\Runtime\InteropServices\JavaScript\TimerTests.cs" Condition="'$(FeatureWasmThreads)' != 'true'"/>
<Compile Include="System\Runtime\InteropServices\JavaScript\Utils.cs" />
<None Include="System\Runtime\InteropServices\JavaScript\JavaScriptTestHelper.mjs" />
<None Include="$(CompilerGeneratedFilesOutputPath)\..\browser-wasm\generated\Microsoft.Interop.JavaScript.JSImportGenerator\Microsoft.Interop.JavaScript.JSImportGenerator\JSImports.g.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ public partial class SecondRuntimeTest
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsBrowserDomSupportedOrNodeJS))]
public static async Task RunSecondRuntimeAndTestStaticState()
{
await JSHost.ImportAsync("SecondRuntimeTest", "../SecondRuntimeTest.js");
var runId = Guid.NewGuid().ToString();
await JSHost.ImportAsync("SecondRuntimeTest", "../SecondRuntimeTest.js?run=" + runId);

Interop.State = 42;
var state2 = await Interop.RunSecondRuntimeAndTestStaticState();
var state2 = await Interop.RunSecondRuntimeAndTestStaticState(runId);
Assert.Equal(44, Interop.State);
Assert.Equal(3, state2);
}
Expand All @@ -31,7 +32,7 @@ public static partial class Interop

[JSImport("runSecondRuntimeAndTestStaticState", "SecondRuntimeTest")]
[return: JSMarshalAs<JSType.Promise<JSType.Number>>]
internal static partial Task<int> RunSecondRuntimeAndTestStaticState();
internal static partial Task<int> RunSecondRuntimeAndTestStaticState(string guid);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export async function runSecondRuntimeAndTestStaticState() {
const { dotnet: dotnet2 } = await import('./_framework/dotnet.js?instance=2');
export async function runSecondRuntimeAndTestStaticState(guid) {
const { dotnet: dotnet2 } = await import('./_framework/dotnet.js?instance=2-' + guid);
const runtime2 = await dotnet2
.withStartupMemoryCache(false)
.withConfig({
Expand Down
Loading
Loading