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

[wasm] Perf benchmark failures - System.Text.Json serializer related failures #88610

Closed
radical opened this issue Jul 10, 2023 · 9 comments · Fixed by dotnet/performance#3115
Closed
Labels
arch-wasm WebAssembly architecture area-System.Text.Json blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' perf-pipeline Issues with dotnet-runtime-perf, or runtime-wasm-perf pipelines
Milestone

Comments

@radical
Copy link
Member

radical commented Jul 10, 2023

Failing for AOT, and interpereter.

Benchmark: Json_ToStream<Location>.SystemTextJson_Reflection:

console.info: Initializing dotnet version 8.0.0-ci commit hash 36481bfd079093fe7d29ef024b1fb801e6c787fe
...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NotSupportedException: JsonTypeInfo metadata for type 'MicroBenchmarks.Serializers.Location' was not provided by TypeInfoResolver of type '[]'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
   at BenchmarkDotNet.Autogenerated.Runnable_7.Run(IHost host, String benchmarkName)
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args)
// AfterAll
test-main.js exiting dba61141-3925-4bba-8dea-e01f32679898.dll --benchmarkName with result -1
MONO_WASM: {"name":"ExitStatus","message":"Program terminated with exit(-1)","status":-1}
console.info: WASM EXIT -1

Benchmark ColdStartSerialization<SimpleStructWithProperties>.NewCustomizedOptions:

console.info: Initializing dotnet version 8.0.0-ci commit hash 36481bfd079093fe7d29ef024b1fb801e6c787fe
...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: JsonSerializerOptions instance must specify a TypeInfoResolver setting before being marked as read-only.
   at System.Text.Json.Serialization.Tests.ColdStartSerialization`1[[MicroBenchmarks.Serializers.SimpleStructWithProperties, MicroBenchmarks, Version=42.42.42.42, Culture=neutral, PublicKeyToken=null]].Setup()
   at BenchmarkDotNet.Autogenerated.Runnable_142.Run(IHost host, String benchmarkName)
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args)
// AfterAll
test-main.js exiting dba61141-3925-4bba-8dea-e01f32679898.dll --benchmarkName with result -1
MONO_WASM: {"name":"ExitStatus","message":"Program terminated with exit(-1)","status":-1}
console.info: WASM EXIT -1

Changes 60799cc...53a10ea ([20230707.3](https://dev.azure.com/dnceng/internal/_build/results?buildId=2216705) to https://dev.azure.com/dnceng/internal/_build/results?buildId=2217531&view=results). The pipeline had other failures earlier, so the starting hash could be a little off.

Sdk version changed from 8.0.100-preview.7.23357.5 to 8.0.100-preview.7.23359.2.
.. which corresponds to dotnet/sdk@f8336e3...cfa4244

dotnet/performance commit used for both was dotnet/performance@a719dec

Known Issue Error Message

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

{
  "ErrorMessage": "",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0
@radical radical added arch-wasm WebAssembly architecture blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' perf-pipeline Issues with dotnet-runtime-perf, or runtime-wasm-perf pipelines labels Jul 10, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 10, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jul 10, 2023
@ghost
Copy link

ghost commented Jul 10, 2023

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

Issue Details

Failing for AOT, and interpereter.

Benchmark: Json_ToStream<Location>.SystemTextJson_Reflection:

console.info: Initializing dotnet version 8.0.0-ci commit hash 36481bfd079093fe7d29ef024b1fb801e6c787fe
...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NotSupportedException: JsonTypeInfo metadata for type 'MicroBenchmarks.Serializers.Location' was not provided by TypeInfoResolver of type '[]'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
   at BenchmarkDotNet.Autogenerated.Runnable_7.Run(IHost host, String benchmarkName)
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args)
// AfterAll
test-main.js exiting dba61141-3925-4bba-8dea-e01f32679898.dll --benchmarkName with result -1
MONO_WASM: {"name":"ExitStatus","message":"Program terminated with exit(-1)","status":-1}
console.info: WASM EXIT -1

Benchmark ColdStartSerialization<SimpleStructWithProperties>.NewCustomizedOptions:

console.info: Initializing dotnet version 8.0.0-ci commit hash 36481bfd079093fe7d29ef024b1fb801e6c787fe
...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: JsonSerializerOptions instance must specify a TypeInfoResolver setting before being marked as read-only.
   at System.Text.Json.Serialization.Tests.ColdStartSerialization`1[[MicroBenchmarks.Serializers.SimpleStructWithProperties, MicroBenchmarks, Version=42.42.42.42, Culture=neutral, PublicKeyToken=null]].Setup()
   at BenchmarkDotNet.Autogenerated.Runnable_142.Run(IHost host, String benchmarkName)
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args)
// AfterAll
test-main.js exiting dba61141-3925-4bba-8dea-e01f32679898.dll --benchmarkName with result -1
MONO_WASM: {"name":"ExitStatus","message":"Program terminated with exit(-1)","status":-1}
console.info: WASM EXIT -1

Changes 60799cc...53a10ea ([20230707.3](https://dev.azure.com/dnceng/internal/_build/results?buildId=2216705) to https://dev.azure.com/dnceng/internal/_build/results?buildId=2217531&view=results). The pipeline had other failures earlier, so the starting hash could be a little off.

Sdk version changed from 8.0.100-preview.7.23357.5 to 8.0.100-preview.7.23359.2.
.. which corresponds to dotnet/sdk@f8336e3...cfa4244

dotnet/performance commit used for both was dotnet/performance@a719dec

Author: radical
Assignees: -
Labels:

arch-wasm, blocking-clean-ci, perf-pipeline

Milestone: -

@radical
Copy link
Member Author

radical commented Jul 10, 2023

@eiriktsarpalis Any idea what might be wrong here?

@eiriktsarpalis
Copy link
Member

Seems related to #88480. These benchmarks target the reflection serializer and thus should never be running in trimmed applications or AOT. Were they even working in AOT before the feature switch got turned on?

@lewing
Copy link
Member

lewing commented Jul 10, 2023

Seems related to #88480. These benchmarks target the reflection serializer and thus should never be running in trimmed applications or AOT. Were they even working in AOT before the feature switch got turned on?

why did you merge that pr on red?

@lewing
Copy link
Member

lewing commented Jul 10, 2023

opened #88612

@radical
Copy link
Member Author

radical commented Jul 10, 2023

ColdStartSerialization - this one seems to have been around since April, and I haven't seen it fail before this.

@lewing
Copy link
Member

lewing commented Jul 10, 2023

yeah I was reading across too many failures apologies for the noise

@eiriktsarpalis
Copy link
Member

@radical I just created this PR that should fix the issue. Can we trigger CI against it to validate?

@radical radical added this to the 8.0.0 milestone Jul 10, 2023
@ghost
Copy link

ghost commented Jul 10, 2023

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Failing for AOT, and interpereter.

Benchmark: Json_ToStream<Location>.SystemTextJson_Reflection:

console.info: Initializing dotnet version 8.0.0-ci commit hash 36481bfd079093fe7d29ef024b1fb801e6c787fe
...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NotSupportedException: JsonTypeInfo metadata for type 'MicroBenchmarks.Serializers.Location' was not provided by TypeInfoResolver of type '[]'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
   at BenchmarkDotNet.Autogenerated.Runnable_7.Run(IHost host, String benchmarkName)
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args)
// AfterAll
test-main.js exiting dba61141-3925-4bba-8dea-e01f32679898.dll --benchmarkName with result -1
MONO_WASM: {"name":"ExitStatus","message":"Program terminated with exit(-1)","status":-1}
console.info: WASM EXIT -1

Benchmark ColdStartSerialization<SimpleStructWithProperties>.NewCustomizedOptions:

console.info: Initializing dotnet version 8.0.0-ci commit hash 36481bfd079093fe7d29ef024b1fb801e6c787fe
...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: JsonSerializerOptions instance must specify a TypeInfoResolver setting before being marked as read-only.
   at System.Text.Json.Serialization.Tests.ColdStartSerialization`1[[MicroBenchmarks.Serializers.SimpleStructWithProperties, MicroBenchmarks, Version=42.42.42.42, Culture=neutral, PublicKeyToken=null]].Setup()
   at BenchmarkDotNet.Autogenerated.Runnable_142.Run(IHost host, String benchmarkName)
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object , IntPtr* , BindingFlags )
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args)
// AfterAll
test-main.js exiting dba61141-3925-4bba-8dea-e01f32679898.dll --benchmarkName with result -1
MONO_WASM: {"name":"ExitStatus","message":"Program terminated with exit(-1)","status":-1}
console.info: WASM EXIT -1

Changes 60799cc...53a10ea ([20230707.3](https://dev.azure.com/dnceng/internal/_build/results?buildId=2216705) to https://dev.azure.com/dnceng/internal/_build/results?buildId=2217531&view=results). The pipeline had other failures earlier, so the starting hash could be a little off.

Sdk version changed from 8.0.100-preview.7.23357.5 to 8.0.100-preview.7.23359.2.
.. which corresponds to dotnet/sdk@f8336e3...cfa4244

dotnet/performance commit used for both was dotnet/performance@a719dec

Known Issue Error Message

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

{
  "ErrorMessage": "",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0
Author: radical
Assignees: -
Labels:

arch-wasm, area-System.Text.Json, blocking-clean-ci, untriaged, perf-pipeline, needs-area-label

Milestone: -

@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 10, 2023
@radical radical removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 10, 2023
radical added a commit to eiriktsarpalis/performance that referenced this issue Jul 10, 2023
@radical radical changed the title [wasm] Perf benchmark failures [wasm] Perf benchmark failures - System.Text.Json serializer related failures Jul 10, 2023
lewing pushed a commit to dotnet/performance that referenced this issue Jul 11, 2023
…3115)

* Explicitly enable JsonSerializerIsReflectionEnabledByDefault

* [wasm] Workaround STJ based tests using reflection

Original issue: dotnet/runtime#88610

* Revert "Explicitly enable JsonSerializerIsReflectionEnabledByDefault"

This reverts commit 2b7a6c8.

---------

Co-authored-by: Ankit Jain <radical@gmail.com>
@ghost ghost locked as resolved and limited conversation to collaborators Aug 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Text.Json blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' perf-pipeline Issues with dotnet-runtime-perf, or runtime-wasm-perf pipelines
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants