Bug 47424 - ARM64 issue with lock on Dictionary causes KeyNotFoundException
Summary: ARM64 issue with lock on Dictionary causes KeyNotFoundException
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-18 21:29 UTC by Andi McClure
Modified: 2016-12-01 20:08 UTC (History)
4 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Andi McClure 2016-11-18 21:29:41 UTC
This seems to be a new error but has occurred six times in the last week. So far it occurs on ARM64 *ONLY*

The test MonoTests.Remoting.RemotingServicesTest.GetRealProxy fails with a managed exception and this stack trace:

                                                MESSAGE:
                                                System.Collections.Generic.KeyNotFoundException : The given key was not present in the dictionary.
                                                +++++++++++++++++++
                                                STACK TRACE:
                                                  at System.ThrowHelper.ThrowKeyNotFoundException () [0x00000] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-arm64/mcs/class/referencesource/mscorlib/system/throwhelper.cs:68 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x00021] in <90234c02397e4bbe9ce0c6143919be6a>:0 
  at System.Net.Sockets.SafeSocketHandle.ReleaseHandle () [0x00085] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-arm64/mcs/class/System/System.Net.Sockets/SafeSocketHandle.cs:63 
  at System.Runtime.InteropServices.SafeHandle.DangerousReleaseInternal (System.Boolean dispose) [0x000d3] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-arm64/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs:227 
  at System.Runtime.InteropServices.SafeHandle.InternalDispose () [0x00011] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-arm64/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs:156 
  at System.Runtime.InteropServices.SafeHandle.Dispose (System.Boolean disposing) [0x00006] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-arm64/mcs/class/referencesource/mscorlib/system/runtime/interopservices/safehandle.cs:260 
  at System.Runtime.InteropServices.SafeHandle.Dispose () [0x00000] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-arm64/mcs/class/referencesource/mscorlib/system/runtime/interopservices/safehandle.cs:252 
  at System.Net.Sockets.Socket.Dispose (System.Boolean disposing) [0x00047] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-arm64/mcs/class/System/System.Net.Sockets/Socket.cs:2591 
  at System.Net.Sockets.Socket.Dispose () [0x00000] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-arm64/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs:6396 
[snip]

Examples:
https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/1228/testReport/(root)/RemotingServicesTest/GetRealProxy/
https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/1201/testReport/(root)/RemotingServicesTest/GetRealProxy/
https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/1219/testReport/(root)/RemotingServicesTest/GetRealProxy/
Comment 1 Andi McClure 2016-11-18 22:10:44 UTC
Possibly related to #47433
Comment 4 Zoltan Varga 2016-12-01 20:08:19 UTC
This is caused by some kind of thread abort problem, the code looks like this:

			try {
				safeHandle.RegisterForBlockingSyscall ();
				var ret = Accept_internal (safeHandle.DangerousGetHandle (), out error, blocking);
				return new SafeSocketHandle (ret, true);
			} finally {
				safeHandle.UnRegisterForBlockingSyscall ();
			}

Register is called, but UnRegister is not, which causes the exception in ReleaseHandle () later.

Note You need to log in before you can comment on or make changes to this bug.