Skip to content

[wasm][aot] System.Runtime.Serialization.Xml.Tests - Maximum call stack size exceeded #61061

Closed

Description

@radical

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

Activity

  1. ghost added
    untriaged
    on Nov 1, 2021
  2. added
    arch-wasm
    disabled-test
    on Nov 1, 2021
  3. added
    wasm-aot-test
    and removed
    untriaged
    on Nov 1, 2021
  4. added this to the 7.0.0 milestone on Nov 1, 2021
  5. radical commented on May 3, 2022

    @radical
    MemberAuthor
  6. vargaz commented on May 3, 2022

    @vargaz
    Contributor

    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.

  7. vargaz commented on May 3, 2022

    @vargaz
    Contributor

    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()
         {
    
  8. lewing commented on May 4, 2022

    @lewing
    Member

    #1417 has some history behind it

  9. lewing commented on May 4, 2022

    @lewing
    Member

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

  10. vargaz commented on May 4, 2022

    @vargaz
    Contributor

    Yes, without it, it runs for me.

  11. radical commented on May 5, 2022

    @radical
    MemberAuthor

    Should this be ActiveIssue, or just SkipOnPlatform?

  12. radical commented on May 5, 2022

    @radical
    MemberAuthor

    Opened #68921

  13. ghost added
    in-pr
    on May 10, 2022
  14. ghost removed
    in-pr
    on May 10, 2022
  15. ghost locked as resolved and limited conversation to collaborators on Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-wasmarea-Codegen-AOT-monodisabled-testwasm-aot-test

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions