Skip to content

Test failure Interop/ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.sh #52829

Closed

Description

@VincentBu

Run: runtime-coreclr gcstress0x3-gcstress0xc 20210516.1

Failed test:

CoreCLR OSX arm64 Checked gcstress0x3 @ OSX.1100.ARM64.Open

- Interop/ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.sh

Error message:

Return code:      1
Raw output file:      /private/tmp/helix/working/B57C096F/w/A47D0925/e/Interop/ObjectiveC/Reports/Interop.ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.output.txt
Raw output:
BEGIN EXECUTION
/tmp/helix/working/B57C096F/p/corerun ObjectiveCMarshalAPI.dll ''
Running Validate_ReferenceTrackingAPIs_InvalidArgs...
Running Validate_ReferenceTracking_Scenario...
Test Failure: TestLibrary.AssertTestException: Assert.AreEqual: Expected: [2]. Actual: [4].
at TestLibrary.Assert.HandleFail(String assertionName, String message) in TestLibrary.dll:token 0x6000021+0x11
at TestLibrary.Assert.AreEqual[T](T expected, T actual, String message) in TestLibrary.dll:token 0x6000010+0x3d
at ObjectiveCMarshalAPI.Program.Validate_ReferenceTracking_Scenario() in ObjectiveCMarshalAPI.dll:token 0x600000d+0xbe
at ObjectiveCMarshalAPI.Program.Main(String[] doNotUse) in ObjectiveCMarshalAPI.dll:token 0x6000015+0x0
Expected: 100
Actual: 101
END EXECUTION - FAILED
Test Harness Exitcode is : 1
To run the test:

set CORE_ROOT=/tmp/helix/working/B57C096F/p
/private/tmp/helix/working/B57C096F/w/A47D0925/e/Interop/ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.sh
Expected: True
Actual:   False


Stack trace
   at Interop_ObjectiveC._ObjectiveCMaralAPI_ObjectiveCMaralAPI_ObjectiveCMaralAPI_._ObjectiveCMarshalAPI_ObjectiveCMarshalAPI_ObjectiveCMarshalAPI_sh()

Activity

  1. ghost added
    untriaged
    on May 17, 2021
  2. VincentBu commented on May 17, 2021

    @VincentBu
    ContributorAuthor

    Historical failures of this test:

    Queued OS Arch Pipeline
    2021-05-16T23:33:06.538Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_tailcallstress
    2021-05-16T23:20:48.793Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_jitstress2
    2021-05-16T23:14:09.047Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_jitstress1
    2021-05-16T23:10:27.968Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_zapdisable_heapverify1
    2021-05-16T22:53:33.315Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_zapdisable
    2021-05-16T22:53:30.439Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_zapdisable_jitstress2
    2021-05-16T15:17:50.068Z osx.1100.arm64.open arm64 runtime-coreclr gcstress0x3-gcstress0xc Checked-gcstress0x3
    2021-05-16T15:17:47.99Z osx.1100.arm64.open arm64 runtime-coreclr gcstress0x3-gcstress0xc Checked-gcstress0xc
    2021-05-16T08:44:30.407Z osx.1013.amd64.open x64 runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_jitminopts_heapverify1
    More failures
    Queued OS Arch Pipeline
    2021-05-16T08:30:47.963Z osx.1013.amd64.open x64 runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_jitstress2
    2021-05-16T08:16:45.646Z osx.1013.amd64.open x64 runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_jitstress1
    2021-05-16T08:10:00.717Z osx.1013.amd64.open x64 runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_zapdisable_heapverify1
    2021-05-16T07:50:06.006Z osx.1100.arm64.open arm64 runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_zapdisable_jitstress2
    2021-05-16T07:50:04.797Z osx.1100.arm64.open arm64 runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_zapdisable
    2021-05-16T07:49:54.228Z osx.1013.amd64.open x64 runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_zapdisable
    2021-05-16T04:45:45.743Z osx.1100.arm64.open arm64 runtime-coreclr r2r-extra Checked-gcstress0xf
    2021-05-15T23:26:15.55Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_tailcallstress
    2021-05-15T23:11:33.657Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_jitstress2
    2021-05-15T23:06:56.14Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_jitstress1
    2021-05-15T23:06:52.982Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_zapdisable_heapverify1
    2021-05-15T22:45:37.064Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_zapdisable
    2021-05-15T22:45:34.872Z osx.1100.arm64.open arm64 runtime-coreclr gcstress-extra Checked-gcstress0xc_zapdisable_jitstress2
    2021-05-15T14:46:02.487Z osx.1100.arm64.open arm64 runtime-coreclr gcstress0x3-gcstress0xc Checked-gcstress0x3
    2021-05-15T14:46:01.592Z osx.1100.arm64.open arm64 runtime-coreclr gcstress0x3-gcstress0xc Checked-gcstress0xc
  3. VincentBu commented on May 17, 2021

    @VincentBu
    ContributorAuthor

    Also failed in runtime-coreclr gcstress-extra 20210515.1

    Failed test:

    CoreCLR OSX arm64 Checked gcstress0xc_zapdisable_jitstress2 @ OSX.1100.ARM64.Open
    
    - Interop/ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.sh
    
    Error message
    Process terminated. A callback was made on a garbage collected delegate of type 'ObjectiveCMarshalAPI!ObjectiveCMarshalAPI.Program+ThrowExceptionDelegate::Invoke'.
    Repeat 2 times:
    at ObjectiveCMarshalAPI.NativeObjCMarshalTests.CallAndCatch(IntPtr, Int32)
    at ObjectiveCMarshalAPI.Program._Validate_ExceptionPropagation()
    at ObjectiveCMarshalAPI.Program.Validate_ReferenceTracking_Scenario()
    at ObjectiveCMarshalAPI.Program.Main(System.String[])
    task_for_pid(83146) FAILED 5 (os/kern) failure
    /private/tmp/helix/working/B98F0A50/w/AE4A09A7/e/Interop/ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.sh: line 377: 83146 Abort trap: 6           (core dumped) $LAUNCHER $ExePath "${CLRTestExecutionArguments[@]}"
    
    Return code:      1
    Raw output file:      /private/tmp/helix/working/B98F0A50/w/AE4A09A7/e/Interop/ObjectiveC/Reports/Interop.ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.output.txt
    Raw output:
    BEGIN EXECUTION
    /tmp/helix/working/B98F0A50/p/corerun ObjectiveCMarshalAPI.dll ''
    Running Validate_ReferenceTrackingAPIs_InvalidArgs...
    Running Validate_ReferenceTracking_Scenario...
    Expected: 100
    Actual: 134
    END EXECUTION - FAILED
    Test Harness Exitcode is : 1
    To run the test:
    
    set CORE_ROOT=/tmp/helix/working/B98F0A50/p
    /private/tmp/helix/working/B98F0A50/w/AE4A09A7/e/Interop/ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.sh
    Expected: True
    Actual:   False
    
    
    Stack trace
       at Interop_ObjectiveC._ObjectiveCMaralAPI_ObjectiveCMaralAPI_ObjectiveCMaralAPI_._ObjectiveCMarshalAPI_ObjectiveCMarshalAPI_ObjectiveCMarshalAPI_sh()
    
    
  4. BruceForstall commented on May 17, 2021

    @BruceForstall
    Contributor
  5. removed
    untriaged
    on May 18, 2021
  6. added this to the 6.0.0 milestone on May 18, 2021
  7. sdmaclea commented on May 19, 2021

    @sdmaclea
    Contributor

    Running locally with GCStress=c I get

    /Users/stmaclea/git/runtime/artifacts/tests/coreclr/OSX.arm64.Release/Tests/Core_Root/corerun ObjectiveCMarshalAPI.dll
    
    Running Validate_ReferenceTrackingAPIs_InvalidArgs...
    Running Validate_ReferenceTracking_Scenario...
    Process terminated. A callback was made on a garbage collected delegate of type 'ObjectiveCMarshalAPI!ObjectiveCMarshalAPI.Program+ThrowExceptionDelegate::Invoke'.
    Repeat 2 times:
    --------------------------------
       at ObjectiveCMarshalAPI.NativeObjCMarshalTests.CallAndCatch(IntPtr, Int32)
    --------------------------------
       at ObjectiveCMarshalAPI.Program._Validate_ExceptionPropagation()
       at ObjectiveCMarshalAPI.Program.Validate_ReferenceTracking_Scenario()
       at ObjectiveCMarshalAPI.Program.Main(System.String[])
    
  8. AaronRobinsonMSFT commented on May 19, 2021

    @AaronRobinsonMSFT
    Member

    Shoot. I always forget this when I am trying to test these scenarios. The Delegate is being collected. I see the issue.

  9. ghost added
    in-pr
    on May 20, 2021
  10. ghost removed
    in-pr
    on May 20, 2021
  11. sdmaclea commented on May 20, 2021

    @sdmaclea
    Contributor

    @AaronRobinsonMSFT Are we sure your fix #53005 for the test isn't covering up a real runtime issue? I would have expected the delegate argument to protect the delegate from collection.

  12. AaronRobinsonMSFT commented on May 20, 2021

    @AaronRobinsonMSFT
    Member

    I would have expected the delegate argument to protect the delegate from collection.

    @sdmaclea The Delegate instance in this case is implicit because it is being passed to the Marshal.GetFunctionPointerForDelegate() as a method. The call finishes and the pointer is added to the Scenario instance in the array. There is no place for the implicit Delegate to exist and even if it did leave it on the stack it is no longer used so there is technically no reason the GC couldn't immediately collect the Delegate.

    This is common problem in these scenarios and why when I saw the error above I knew the issue. We do document this in the API but it is unfortunately a small footnote.

    You must manually keep the delegate from being collected by the garbage collector from managed code. The garbage collector does not track references to unmanaged code.

  13. sdmaclea commented on May 20, 2021

    @sdmaclea
    Contributor
  14. BruceForstall commented on May 27, 2021

    @BruceForstall
    Contributor

    @AaronRobinsonMSFT I see this test fail in a current GCStress0x3 run:

    https://dev.azure.com/dnceng/public/_build/results?buildId=1158649&view=ms.vss-test-web.build-test-results-tab&runId=34974862&resultId=101901&paneView=debug

    Return code:      1
    Raw output file:      /private/tmp/helix/working/B3D10A12/w/A55408C1/e/Interop/ObjectiveC/Reports/Interop.ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.output.txt
    Raw output:
    BEGIN EXECUTION
    /tmp/helix/working/B3D10A12/p/corerun ObjectiveCMarshalAPI.dll ''
    Running Validate_ReferenceTrackingAPIs_InvalidArgs...
    Running Validate_ReferenceTracking_Scenario...
    Test Failure: TestLibrary.AssertTestException: Assert.AreEqual: Expected: [2]. Actual: [4].
    at TestLibrary.Assert.HandleFail(String assertionName, String message) in TestLibrary.dll:token 0x6000021+0x11
    at TestLibrary.Assert.AreEqual[T](T expected, T actual, String message) in TestLibrary.dll:token 0x6000010+0x3d
    at ObjectiveCMarshalAPI.Program.Validate_ReferenceTracking_Scenario() in ObjectiveCMarshalAPI.dll:token 0x600000d+0xbe
    at ObjectiveCMarshalAPI.Program.Main(String[] doNotUse) in ObjectiveCMarshalAPI.dll:token 0x6000015+0x0
    Expected: 100
    Actual: 101
    END EXECUTION - FAILED
    Test Harness Exitcode is : 1
    To run the test:
    
    set CORE_ROOT=/tmp/helix/working/B3D10A12/p
    /private/tmp/helix/working/B3D10A12/w/A55408C1/e/Interop/ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.sh
    Expected: True
    Actual:   False
    
  15. AaronRobinsonMSFT commented on May 27, 2021

    @AaronRobinsonMSFT
    Member

    @BruceForstall That is a slightly different issue than the one presented here. I will create a new issue.

  16. ghost locked as resolved and limited conversation to collaborators on Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions