Bug 19290 - mtbserver crash with OOM
Summary: mtbserver crash with OOM
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-04-24 23:16 UTC by Virgile Bello
Modified: 2016-12-22 18:17 UTC (History)
7 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 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 Virgile Bello 2014-04-24 23:16:40 UTC
Paired with Visual Studio, I have a mtbserver huge CPU consumption and crash.

It happens when we have many (link) errors with native libraries, while paired to VS2012.
LD outputs lot of errors, and mtbserver is having problem processing them as soon as there is 50+ of them (takes MUCH longer than expected), then often crashes with out of memory exception.

Sometimes, it fails with OutOfMemoryException within "ContainsMsBuildErrorFormat" (run1), and some other times it could pass this step, and displayed many MsBuild error messages (run2). Please see details log at the end of this message.

From those 2 logs, my guess is that when there is enough errors from linking, there is too heavy regexp running on LD output to report errors (or something like that).
It ends up taking a very long time (5+ minutes! with 100% CPU busy) and often crashing (which means we can't even have any log).

Can you please fix the way you regex/parse/process this clang/gcc/ld output so that it doesn't affect build time/stability? This really makes our development cycle much slower, as it takes ages to compile, test and know where errors come from when it crashes like this.
Ideally those errors should be reported properly on Visual Studio side, but simply being fast and not crashing (so that we can check mac log) would be enough for now.

Here is log of some of it:

RUN1: (OutOfMemoryException within "ContainsMsBuildErrorFormat")

[[[first line, really really long mtouch command with many many -u _FT_New_library (link statically to Freetype) but without the libfreetype itself, so it generates undefined symbols error]]]
[24-4-2014 19:25:45] Error: Tool MonoTouch.Tools.Tools.Mtouch failed to run\
[24-4-2014 19:25:45] Exception: Exception type: System.OutOfMemoryException\
Out of memory\
  at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_specific (intptr,int)\
  at System.Text.RegularExpressions.Interpreter.CreateMark (Int32 previous) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Open (Int32 gid, Int32 ptr) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.TryMatch (System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Eval (Mode mode, System.Int32& ref_ptr, Int32 pc) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Interpreter.Scan (System.Text.RegularExpressions.Regex regex, System.String text, Int32 start, Int32 end) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Regex.Match (System.String input, Int32 startat) [0x00000] in <filename unknown>:0 \
  at System.Text.RegularExpressions.Regex.Match (System.String input) [0x00000] in <filename unknown>:0 \
  at MonoTouch.Tools.BuildError.ContainsMsBuildErrorFormat (System.String lineText) [0x00000] in <filename unknown>:0 \
  at MonoTouch.Tools.BuildError.ContainsMsBuildErrorFormat (System.Text.StringBuilder stringBuilder) [0x00000] in <filename unknown>:0 \
  at MonoTouch.Tools.Tools.ToolBase.MsBuildErrorDetection (System.Text.StringBuilder error) [0x00000] in <filename unknown>:0 \
  at MonoTouch.Tools.Tools.ToolBase.RunInner (MonoTouch.Tools.Tools.RunInfo ri) [0x00000] in <filename unknown>:0 \
  at MonoTouch.Tools.Tools.ToolBase.Run () [0x00000] in <filename unknown>:0 \
  at MonoTouch.Tools.Tools.Mtouch.Run () [0x00000] in <filename unknown>:0 \
  at Mtb.Server.Commands.Build.RunTools (System.Collections.Generic.List`1 tools, ILoggingHelper logger) [0x00000] in <filename unknown>:0 \


RUN2: MsBuild error messages
Undefined symbols for architecture armv7:\
  "_I32_LZ4_compressHC_limitedOutput", referenced from:\
     -u command line option\
  "_I64_LZ4_compress_limitedOutput", referenced from:\
     -u command line option\
  "_I32_LZ4_compress_limitedOutput", referenced from:\
     -u command line option\
  "_FT_ClassicKern_Free", referenced from:\
     -u command line option\
  "_FT_TrueTypeGX_Validate", referenced from:\
     -u command line option\
  "_FTC_SBitCache_LookupScaler", referenced from:\
     -u command line option\
  "_FTC_SBitCache_Lookup", referenced from:\
     -u command line option\
  "_FT_OpenType_Validate", referenced from:\
     -u command line option\
  "_FTC_SBitCache_New", referenced from:\
     -u command line option\
etc.... (approx ~100 of them)
ld: symbol(s) not found for architecture armv7\
clang: error: linker command failed with exit code 1 (use -v to see invocation)\
\
error MT5210: Native linking failed, undefined symbol: _I32_LZ4_compressHC_limitedOutput. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
error MT5210: Native linking failed, undefined symbol: _I64_LZ4_compress_limitedOutput. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
error MT5210: Native linking failed, undefined symbol: _I32_LZ4_compress_limitedOutput. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
error MT5210: Native linking failed, undefined symbol: _FT_ClassicKern_Free. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
error MT5210: Native linking failed, undefined symbol: _FT_TrueTypeGX_Validate. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
error MT5210: Native linking failed, undefined symbol: _FTC_SBitCache_LookupScaler. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
error MT5210: Native linking failed, undefined symbol: _FTC_SBitCache_Lookup. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
error MT5210: Native linking failed, undefined symbol: _FT_OpenType_Validate. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
error MT5210: Native linking failed, undefined symbol: _FTC_SBitCache_New. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
error MT5210: Native linking failed, undefined symbol: _FTC_ImageCache_New. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.\
etc... (approx 100 of them)
error MT5202: Native linking failed. Please review the build log.\
Comment 1 Daniel Cazzulino 2014-06-02 16:21:34 UTC
Could you please attach the VS log files available from VS Help > Zip Xamarin Logs?

Thanks!
Comment 2 Jose Gallardo 2016-12-22 18:17:34 UTC
Hi,
As we've introduced several improvements around VS/Mac connectivity and the iOS build system, I'll mark the bug as resolved fixed.
Please feel free to reopen it if you can still reproduce the issue with current bits.
Thanks!