You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test failure Interop/ObjectiveC/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI/ObjectiveCMarshalAPI.sh #52829
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()
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()
/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[])
@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.
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.
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
Activity
VincentBu commentedon May 17, 2021
Historical failures of this test:
More failures
VincentBu commentedon May 17, 2021
Also failed in runtime-coreclr gcstress-extra 20210515.1
Failed test:
BruceForstall commentedon May 17, 2021
@AaronRobinsonMSFT @sdmaclea
sdmaclea commentedon May 19, 2021
Running locally with
GCStress=cI getAaronRobinsonMSFT commentedon May 19, 2021
Shoot. I always forget this when I am trying to test these scenarios. The
Delegateis being collected. I see the issue.sdmaclea commentedon May 20, 2021
@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.
AaronRobinsonMSFT commentedon May 20, 2021
@sdmaclea The
Delegateinstance in this case is implicit because it is being passed to theMarshal.GetFunctionPointerForDelegate()as a method. The call finishes and the pointer is added to theScenarioinstance in the array. There is no place for the implicitDelegateto 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 theDelegate.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.
sdmaclea commentedon May 20, 2021
Thanks @AaronRobinsonMSFT
BruceForstall commentedon May 27, 2021
@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
AaronRobinsonMSFT commentedon May 27, 2021
@BruceForstall That is a slightly different issue than the one presented here. I will create a new issue.