Bug 49398 - XML deserialization invokes roslyn csc, which often hangs
Summary: XML deserialization invokes roslyn csc, which often hangs
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-12-08 22:33 UTC by Andi McClure
Modified: 2016-12-12 15:01 UTC (History)
2 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Andi McClure 2016-12-08 22:33:56 UTC
On about 50% of builds, the mcs/class/System.XML "make check" fails with a hang on one or more Linux platforms. The hang is only seen on Linux platforms. If one drills down into the logs

https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/1400/parsed_console/log_content.html#WARNING2
https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/1400/parsed_console/log_content.html#WARNING2

The hang is occurring while the code is in MonoTests.System.XmlSerialization.XmlSerializerTests.TestSerializeEnumDefaultValue_Encoded
and the stack is like 

  at (wrapper managed-to-native) System.Threading.WaitHandle.WaitOne_internal (intptr,int) <0x0003f>
  at System.Threading.WaitHandle.WaitOneNative (System.Runtime.InteropServices.SafeHandle,uint,bool,bool) <IL 0x00019, 0x00067>
  at System.Threading.WaitHandle.InternalWaitOne (System.Runtime.InteropServices.SafeHandle,long,bool,bool) <IL 0x00019, 0x00047>
  at System.Threading.WaitHandle.WaitOne (long,bool) <IL 0x00010, 0x00043>
  at System.Threading.WaitHandle.WaitOne (int,bool) <IL 0x0001d, 0x0004b>
  at System.Diagnostics.Process.WaitForExit (int) [0x00024] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-armel/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2561
  at System.Diagnostics.Process.WaitForExit () [0x00000] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-armel/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2603
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.WaitForExit () <IL 0x00032, 0x0005f>
  at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch (System.CodeDom.Compiler.CompilerParameters,string[]) [0x00177] in /media/ssd/jenkins/workspace/test-mono-mainline-linux/label/debian-8-armel/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs:192


If I run this test myself on one of the ARM64 builders

(cd mcs/class/System.XML && PATH="/media/ssd/andi-mcclure/mono/runtime/_tmpinst/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" MONO_REGISTRY_PATH="/home/ubuntu/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" MONO_PATH="./:./../../class/lib/net_4_x::$MONO_PATH" /media/ssd/andi-mcclure/mono/runtime/mono-wrapper --debug   ./../../class/lib/net_4_x/nunit-lite-console.exe  net_4_x_System.Xml_test.dll -test:MonoTests.System.XmlSerialization.XmlSerializerTests.TestSerializeEnumDefaultValue_Encoded -labels)

I find that (in my tests at least) this test appears to hang frequently. When it finishes it finishes in something like a minute and five seconds, I've also seen it hang for over 15 minutes before I gave up and killed it. When it does hang, if I run ps I find csc is running.

I did not manage to grab a ps when it was hung, but here is a ps from when it was just running normally:

$ ps ux | grep csc
[USERNAME]   31955  0.0  0.0   1868   576 pts/27   S+   22:20   0:00 /bin/sh /media/ssd/andi-mcclure/mono/runtime/_tmpinst/bin/mono /media/ssd/andi-mcclure/mono/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.1.3.2/tools/csc.exe /target:library /debug- /optimize+ /out:/tmp/4c276c55/5755662f.dll /r:/media/ssd/andi-mcclure/mono/mcs/class/lib/net_4_x/mscorlib.dll /r:/media/ssd/andi-mcclure/mono/mcs/class/System.XML/net_4_x_System.Xml_test.dll /r:/media/ssd/andi-mcclure/mono/mcs/class/lib/net_4_x/System.Xml.dll /nostdlib /D:_DYNAMIC_XMLSERIALIZER_COMPILATION /noconfig /nologo /tmp/4c276c55/5755662f.0.cs
[USERNAME]   31956  146  1.6 575632 66484 pts/27   Sl+  22:20   0:04 /media/ssd/andi-mcclure/mono/mono/mini/mono --config /media/ssd/andi-mcclure/mono/runtime/etc/mono/config /media/ssd/andi-mcclure/mono/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.1.3.2/tools/csc.exe /target:library /debug- /optimize+ /out:/tmp/4c276c55/5755662f.dll /r:/media/ssd/andi-mcclure/mono/mcs/class/lib/net_4_x/mscorlib.dll /r:/media/ssd/andi-mcclure/mono/mcs/class/System.XML/net_4_x_System.Xml_test.dll /r:/media/ssd/andi-mcclure/mono/mcs/class/lib/net_4_x/System.Xml.dll /nostdlib /D:_DYNAMIC_XMLSERIALIZER_COMPILATION /noconfig /nologo /tmp/4c276c55/5755662f.0.cs
[USERNAME]   31979  0.0  0.0   2600   632 pts/28   S+   22:20   0:00 grep csc

The test TestSerializeEnumDefaultValue_Encoded is actually very simple, just judging from code inspection, so even when it does not hang, it seems that taking over a minute to run is not appropriate at all.
Comment 1 Marek Safar 2016-12-09 01:52:53 UTC
Alexander, could you figure out what is hanging?
Comment 2 Marek Safar 2016-12-09 02:10:19 UTC
Actually I'll take care of it
Comment 3 Marek Safar 2016-12-12 15:01:01 UTC
Fixed in master