我有一个在Mono上运行的C#,多线程,TCP服务器应用程序。这是过去4年在100多台服务器上运行的应用程序,没有任何问题。我在Windows上编译该应用程序,然后将其加载到Ubuntu机器上并运行它..
效果很好!
但是,在使用OVH(通过OneProvider)托管的两台新服务器上,此过程每次运行约20分钟,之后Mono崩溃并出现以下错误:
mono-0 (err): =================================================================
mono-0 (err): Got a SIGSEGV while executing native code. This usually indicates
mono-0 (err): a fatal error in the mono runtime or one of the native libraries
mono-0 (err): used by your application.
mono-0 (err): =================================================================
在单声道崩溃之前,我在应用程序中捕获异常并将其输出到控制台,异常总是不同并且总是很奇怪。例如,String.Format中的null对象异常或设置类级别枚举值时的null对象异常(this == null ??)
示例1
mono-0 (out): System.NullReferenceException: Object reference not set to an instance of an object
mono-0 (out): at System.String.FormatHelper (System.Text.StringBuilder result, IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0
mono-0 (out): at System.String.Format (IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0
mono-0 (out): at System.String.Format (System.String format, System.Object arg0, System.Object arg1) [0x00000] in <filename unknown>:0
mono-0 (out): at server.handleClinet.logConsole (System.String msg) [0x00000] in <filename unknown>:0
示例2
mono-0 (err): Unhandled Exception:
mono-0 (err): System.ArgumentNullException: Argument cannot be null.
mono-0 (err): Parameter name: obj
mono-0 (err): at server.handleClinet.set_ConnState (ConnectionState value) [0x00000] in <filename unknown>:0
mono-0 (err): at server.handleClinet.doConnect (System.Object p) [0x00000] in <filename unknown>:0
mono-0 (err): at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0
mono-0 (err): [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Argument cannot be null.
mono-0 (err): Parameter name: obj
mono-0 (err): at server.handleClinet.set_ConnState (ConnectionState value) [0x00000] in <filename unknown>:0
mono-0 (err): at server.handleClinet.doConnect (System.Object p) [0x00000] in <filename unknown>:0
mono-0 (err): at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0
在这种情况下,ConnState
是一个枚举,这就是行:
ConnState = ConnectionState.Starting;
据我所知,.NET不会因字符串格式异常或使用此设置枚举值而崩溃。
在我看来,有些事情正在踩着单声道的记忆而整个筹码都被搞砸了。
问题是,这两个特定服务器导致问题的原因是什么?它们运行与所有其他服务器相同的设置,Ubuntu(14.04.2),具有相同版本的Mono(3.2.8)和相同的.net应用程序。
我们已经多次使用新的Ubuntu安装重新加载服务器而没有运气。我们尝试了各种版本的Mono,并尝试针对不同版本的框架(3.4 + 4)。崩溃会因不同的错误而略有变化,但结果总是相同的。
崩溃时系统负载和内存都很好。这两台机器有32GB的ram,单声道在运行时仅使用大约100mb。还有足够的磁盘空间(1.7TB)。
答案 0 :(得分:0)
看起来这是从3.13.0-48
开始引入内核的错误。
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1450584
我们已经回滚到3.13.0-30
,直到3.13.0-54
被释放并且崩溃已经停止。