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][aot] System.Runtime.Serialization.Xml.Tests - Maximum call stack size exceeded #61061

Closed
radical opened this issue Nov 1, 2021 · 9 comments · Fixed by #68921
Closed
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono disabled-test The test is disabled in source code against the issue wasm-aot-test WebAssembly AOT Test
Milestone

Comments

@radical
Copy link
Member

radical commented Nov 1, 2021

Created based on the original issue - #59926 .

The original issue is about a wasm specific failure:

13:05:56] fail: console.error: RangeError: Maximum call stack size exceeded
[13:05:56] fail: console.error: RangeError: Maximum call stack size exceeded
[13:05:56] fail:     at RangeError.valueOf (<anonymous>)
[13:05:56] fail:     at invoke_vi (dotnet.js:7934:16)
[13:05:56] fail:     at mono_llvm_cpp_catch_exception (<anonymous>:wasm-function[116059]:0x1600f99)
[13:05:56] fail:     at do_jit_call (<anonymous>:wasm-function[98812]:0x140c914)

...

[13:05:56] fail:     at interp_exec_method (<anonymous>:wasm-function[98748]:0x13ffb05)
[13:05:56] fail:     at interp_entry (<anonymous>:wasm-function[98794]:0x140bec5)
[13:05:56] fail:     at interp_entry_static_4 (<anonymous>:wasm-function[98891]:0x140e3c7)
[13:05:56] fail:     at corlib_aot_wrapper_gsharedvt_in_sig_void_objobjobjobj (<anonymous>:wasm-function[48062]:0xa03747)
[13:05:56] fail:     at System_Private_DataContractSerialization_wrapper_delegate_invoke__Module_invoke_void_XmlWriterDelegator_object_XmlObjectSerializerWriteContext_ClassDataContract_System_Runtime_Serialization_XmlWriterDelegator_object_System_Runtime_Serialization_XmlObjectSerializerWriteContext_System_Runtime_Serialization_ClassDataContract (<anonymous>:wasm-function[55265]:0xb70608)
[13:05:56] info: Process v8 exited with 1

The tests are currently disabled for wasm (#60258).

Also (#59926 (comment)):

I couldn't reproduce this on macOS, but I can on ubuntu20.04 . The trace suggests that it is in an exception throw/catch loop.

Useful for testing:
WasmXHarnessArgs="-v:trace" WasmXHarnessMonoArgs="--runtime-arg=--trace=E"

cc @pavelsavara

@dotnet-issue-labeler dotnet-issue-labeler bot added area-Serialization untriaged New issue has not been triaged by the area owner labels Nov 1, 2021
@radical radical added arch-wasm WebAssembly architecture disabled-test The test is disabled in source code against the issue labels Nov 1, 2021
@ghost
Copy link

ghost commented Nov 1, 2021

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

Issue Details

Created based on the original issue - #59926 .

The original issue is about a wasm specific failure:

13:05:56] fail: console.error: RangeError: Maximum call stack size exceeded
[13:05:56] fail: console.error: RangeError: Maximum call stack size exceeded
[13:05:56] fail:     at RangeError.valueOf (<anonymous>)
[13:05:56] fail:     at invoke_vi (dotnet.js:7934:16)
[13:05:56] fail:     at mono_llvm_cpp_catch_exception (<anonymous>:wasm-function[116059]:0x1600f99)
[13:05:56] fail:     at do_jit_call (<anonymous>:wasm-function[98812]:0x140c914)

...

[13:05:56] fail:     at interp_exec_method (<anonymous>:wasm-function[98748]:0x13ffb05)
[13:05:56] fail:     at interp_entry (<anonymous>:wasm-function[98794]:0x140bec5)
[13:05:56] fail:     at interp_entry_static_4 (<anonymous>:wasm-function[98891]:0x140e3c7)
[13:05:56] fail:     at corlib_aot_wrapper_gsharedvt_in_sig_void_objobjobjobj (<anonymous>:wasm-function[48062]:0xa03747)
[13:05:56] fail:     at System_Private_DataContractSerialization_wrapper_delegate_invoke__Module_invoke_void_XmlWriterDelegator_object_XmlObjectSerializerWriteContext_ClassDataContract_System_Runtime_Serialization_XmlWriterDelegator_object_System_Runtime_Serialization_XmlObjectSerializerWriteContext_System_Runtime_Serialization_ClassDataContract (<anonymous>:wasm-function[55265]:0xb70608)
[13:05:56] info: Process v8 exited with 1

The tests are currently disabled was wasm.

Also (#59926 (comment)):

I couldn't reproduce this on macOS, but I can on ubuntu20.04 . The trace suggests that it is in an exception throw/catch loop.

Useful for testing:
WasmXHarnessArgs="-v:trace" WasmXHarnessMonoArgs="--runtime-arg=--trace=E"
Author: radical
Assignees: -
Labels:

arch-wasm, area-Serialization, disabled-test, untriaged

Milestone: -

@radical radical added area-Codegen-AOT-mono wasm-aot-test WebAssembly AOT Test and removed untriaged New issue has not been triaged by the area owner area-Serialization labels Nov 1, 2021
@radical radical added this to the 7.0.0 milestone Nov 1, 2021
@radical
Copy link
Member Author

radical commented May 3, 2022

cc @vargaz

@vargaz
Copy link
Contributor

vargaz commented May 3, 2022

This looks like a real stack overflow, there are 1000 native frames on the stack, the problem seems to be a dynamic method named

(wrapper dynamic-method) void object:WriteTypeWithLinkedPropertyToXml (System.Runtime.Serialization.XmlWriterDelegator,object,System.Runtime.Serialization.XmlObjectSerializerWriteContext,System.Runtime.Serialization.ClassDataContract)

which is invoked recursively, causing execution to enter and exit the interpreter, adding a lot of extra frames and stack space.

@vargaz
Copy link
Contributor

vargaz commented May 3, 2022

Disabling the DCS_DeeplyLinkedData () test on wasm fixes it:

diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs
index 6ab67b426a3..6f80999a215 100644
--- a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs
+++ b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs
@@ -4256,6 +4256,7 @@ public static void DCS_TypeWithPrimitiveKnownTypes()
     }
 
     [ActiveIssue("https://github.com/dotnet/runtime/issues/1417", TestPlatforms.OSX)]
+    [SkipOnPlatform(TestPlatforms.Browser, "Causes a stack overflow")]
     [Fact]
     public static void DCS_DeeplyLinkedData()
     {

@lewing
Copy link
Member

lewing commented May 4, 2022

#1417 has some history behind it

@lewing
Copy link
Member

lewing commented May 4, 2022

Is this the only failing xml test so that we disable this and reenable the assembly?

@vargaz
Copy link
Contributor

vargaz commented May 4, 2022

Yes, without it, it runs for me.

@radical
Copy link
Member Author

radical commented May 5, 2022

Should this be ActiveIssue, or just SkipOnPlatform?

radical added a commit to radical/runtime that referenced this issue May 5, 2022
This was disabled due to dotnet#59926,
which was then tracked by dotnet#61061
.

The stack overflow is due to one specific test though, and the rest of
the tests can be enabled if we skip this one - `DCS_DeeplyLinkedData`.
@radical
Copy link
Member Author

radical commented May 5, 2022

Opened #68921

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label May 10, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label May 10, 2022
radical added a commit that referenced this issue May 10, 2022
* Reenable `System.Runtime.Serialization.Xml.Tests`

This was disabled due to #59926,
which was then tracked by #61061
.

The stack overflow is due to one specific test though, and the rest of
the tests can be enabled if we skip this one - `DCS_DeeplyLinkedData`.

* Disable the test with `SkipOnPlatform` instead, for wasm, as it is

.. unlikely to be fixed (- vargaz).
@ghost ghost locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono disabled-test The test is disabled in source code against the issue wasm-aot-test WebAssembly AOT Test
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants