runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[ARM/Linux] Segmentation fault in JIT/Performance/CodeQuality/Serialization/Serialize

Open hqueue opened this issue 10 years ago • 4 comments

Environment:

  • arm-softfp/Linux
  • coreclr(361edab)(release built with -O1)
  • corefx (2cd0c1f8f9f229f3cb5e8e9bcd018559df9efea6)(debug)
  • unix tests (x64, release)

I faced following SEGV in Serialization test.

Starting JIT/Performance/CodeQuality/Serialization/Serialize/Serialize.sh
FAILED   - JIT/Performance/CodeQuality/Serialization/Serialize/Serialize.sh
               BEGIN EXECUTION
               /opt/media/microsd/dotnet/unittest/prebuilt/tests/Windows_NT.x64.Release/Tests/coreoverlay/corerun Serialize.exe
               ./Serialize.sh: line 117: 21715 Segmentation fault      (core dumped) $_DebuggerFullPath "$CORE_ROOT/corerun" Serialize.exe $CLRTestExecutionArguments
               Expected: 100
               Actual: 139
               END EXECUTION - FAILED

FYI. Deserialize is PASSED.

Starting JIT/Performance/CodeQuality/Serialization/Deserialize/Deserialize.sh
PASSED   - JIT/Performance/CodeQuality/Serialization/Deserialize/Deserialize.sh
               BEGIN EXECUTION
               /opt/media/microsd/dotnet/unittest/prebuilt/tests/Windows_NT.x64.Release/Tests/coreoverlay/corerun Deserialize.exe
               Expected: 100
               Actual: 100
               END EXECUTION - PASSED

hqueue avatar Jul 14 '16 07:07 hqueue

With recent corefx (b76659daf1507bacc539245a5abe47c980616ff5), segmentation fault still occurs.

hqueue avatar Jul 14 '16 13:07 hqueue

It seems that this test was failing since long time ago and I still didn't know from when it was failed. (or never PASSED in release build.)

arm-softfp/Linux

  • coreclr(df990785c63cecc10ba042c3606fe69f955588dc) (Jun 9 version) => FAILED with SEGV(Release built with -O1)
  • coreclr(c3e09ed993019ab3a1645cfd78f77112b442f4e8)(Jul 4 version) => FAILED with SEGV(Release built with -O1)
  • coreclr(9a9096bc059c66dbed583cfe986cb2eb61cdfa17)(Jul 14 version) => PASSED(Debug), FAILED with SEGV(Release built with -O1)

hqueue avatar Jul 15 '16 12:07 hqueue

There is some change from recent coreclr with release build with O3.

Now SEGV is gone and unhandled exception is observed due to memory access violation. I suspect that both SEGV and System.AccessViolationException are result from same cause, i.e. memory access violation.

arm-softfp/Linux

  • coreclr (f1b3fc7b704662903c753dc20681693a69266931) (Jul 26 version)=> Unhandled Exception: System.AccessViolationException (Release build with -O3)
Starting JIT/Performance/CodeQuality/Serialization/Serialize/Serialize.sh
FAILED - [ 1][ 8s]JIT/Performance/CodeQuality/Serialization/Serialize/Serialize.sh
 BEGIN EXECUTION
 /opt/media/microsd/dotnet/unittest/coreoverlays/coreclr0726.release.O3/corerun Serialize.exe

 Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
 at System.Xml.XmlConverter.ToAsciiChars(String s, Byte[] buffer, Int32 offset)
 at System.Xml.XmlConverter.ToChars(Double value, Byte[] buffer, Int32 offset)
 at System.Xml.XmlUTF8NodeWriter.WriteDoubleText(Double value)
 at System.Xml.XmlBaseWriter.WriteValue(Double value)
 at System.Xml.XmlDictionaryWriter.WriteArray(String prefix, String localName, String namespaceUri, Double[] array, Int32 offset, Int32 count)
 at System.Xml.XmlDictionaryWriter.WriteArray(String prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, Double[] array, Int32 offset, Int32 count)
 at System.Xml.XmlDictionaryAsyncCheckWriter.WriteArray(String prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, Double[] array, Int32 offset, Int32 count)
 at System.Runtime.Serialization.XmlWriterDelegator.WriteDoubleArray(Double[] value, XmlDictionaryString itemName, XmlDictionaryString itemNamespace)
 at WriteArrayOfdoubleToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )
 at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
 at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
 at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
 at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
 at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
 at WriteJsonBenchmarks.TestObjectToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
 at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
 at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
 at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
 at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
 at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
 at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
 at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph)
 at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter writer, Object graph)
 at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(Stream stream, Object graph)
 at JsonBenchmarks.SerializeDataContractBenchInner(Object o, MemoryStream ms)
 at JsonBenchmarks.SerializeDataContractBench()
 at JsonBenchmarks.SerializeObject()
 at JsonBenchmarks.Main()
 ./Serialize.sh: line 117: 3022 Aborted $_DebuggerFullPath "$CORE_ROOT/corerun" Serialize.exe $CLRTestExecutionArguments
 Expected: 100
 Actual: 134
 END EXECUTION - FAILED

hqueue avatar Jul 27 '16 04:07 hqueue

Now this issue will be discussed in dotnet/coreclr#6698 and will be fixed by PR dotnet/coreclr#6700 if merged.

hqueue avatar Aug 11 '16 05:08 hqueue