我认为我正在寻找一个关于如何处理这个问题的答案,而不是期待一个解决方案,因为我相当肯定这是单声道本身而不是我的应用程序,但也许我'我错了。
我有一个运行在Ubuntu 16.04.1 LTS,64位上的Mono / C#应用程序。它是一个相当简单的应用程序,主要是自动启动和观察机器上的其他进程;所以它真的没有做任何超级复杂的事情。但是,偶尔我会在对象分配期间得到一个SIGSEGV(堆栈跟踪不同于崩溃到崩溃,但通常是在字符串分配期间):
Stacktrace:
at <unknown> <0xffffffff> at (wrapper managed-to-native)
string.FastAllocateString (int) <0x00051> at
string.InternalSubString (int,int) <0x00019> at string.Substring
(int,int) <0x0007b> at string.Substring (int) <0x0001e>
我会说它非常随机,应用程序有时可能会在一周内没有崩溃。鉴于随机性和堆栈跟踪不同的事实以及它在对象分配期间的事实,我担心与GC相关的错误。
以下是崩溃的整个输出:
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) string.FastAllocateString (int) <0x00051>
at string.InternalSubString (int,int) <0x00019>
at string.Substring (int,int) <0x0007b>
at string.Substring (int) <0x0001e>
at WrfSharp.Helpers.FileSystem.FileSystemHelper.PlatformIndependentGetFilename (string) <0x00039>
at WrfSharp.Helpers.FileSystem.FileSystemHelper/<>c.<RetrievePathToWrfOutFile>b__9_0 (string) <0x00027>
at System.Linq.Enumerable/WhereArrayIterator`1<TSource_REF>.MoveNext () <0x00072>
at System.Linq.Enumerable.FirstOrDefault<TSource_REF> (System.Collections.Generic.IEnumerable`1<TSource_REF>) <0x000c2>
at WrfSharp.Helpers.FileSystem.FileSystemHelper.RetrievePathToWrfOutFile (WrfSharp.DataStructures.WrfConfiguration,WrfSharp.Interfaces. IFileSystem) <0x00143>
at WrfSharp.Runner.Program.ComputeStage (WrfSharp.Interfaces.IFileSystem,WrfSharp.Interfaces.ILogger,WrfSharp.Interfaces.IProcessLaunch er,WrfSharp.Interfaces.IEnvironment,WrfSharp.DataStructures.WrfConfiguration,WrfSharp.DataStructures.PhysicsConfiguration) <0x00167>
at WrfSharp.Runner.Program.Main (string[]) <0x00293>
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0x000c8>
Native stacktrace:
mono() [0x4accca]
mono() [0x5040fe]
mono() [0x4275d7]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x113d0) [0x7fe93ef6d3d0]
mono() [0x603d29]
mono() [0x60789b]
mono() [0x607f5c]
mono() [0x5fb80d]
mono() [0x5e8da1]
mono() [0x5c5025]
mono() [0x597899]
[0x407798d2]
Debug info from gdb:
[New LWP 23012]
[New LWP 23013]
[New LWP 23014]
[New LWP 23018]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fe93ef6cfbb in __waitpid (pid=6096, stat_loc=0x7fe93fab211c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
29 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
Id Target Id Frame
* 1 Thread 0x7fe93fa9a740 (LWP 23011) "Main" 0x00007fe93ef6cfbb in __waitpid (pid=6096, stat_loc=0x7fe93fab211c, options=0) at ../sysd eps/unix/sysv/linux/waitpid.c:29
2 Thread 0x7fe93dfff700 (LWP 23012) "SGen worker" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_con d_wait.S:185
3 Thread 0x7fe93e69b700 (LWP 23013) "Finalizer" 0x00007fe93ef6b867 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expect ed=0, futex_word=0x97c100) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
4 Thread 0x7fe93b413700 (LWP 23014) "Timer-Scheduler" 0x00007fe93e9a9816 in __GI___sigsuspend (set=0x97c640) at ../sysdeps/unix/sysv /linux/sigsuspend.c:30
5 Thread 0x7fe93e452700 (LWP 23018) "Threadpool work" 0x00007fe93ea6ee8d in poll () at ../sysdeps/unix/syscall-template.S:84
Thread 5 (Thread 0x7fe93e452700 (LWP 23018)):
#0 0x00007fe93ea6ee8d in poll () at ../sysdeps/unix/syscall-template.S:84
#1 0x00000000005a2b9f in ?? ()
#2 0x00000000005a3bb3 in ?? ()
#3 0x000000000059c68c in ?? ()
#4 0x0000000000653b4c in ?? ()
#5 0x00007fe93ef636fa in start_thread (arg=0x7fe93e452700) at pthread_create.c:333
#6 0x00007fe93ea7ab5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 4 (Thread 0x7fe93b413700 (LWP 23014)):
#0 0x00007fe93e9a9816 in __GI___sigsuspend (set=0x97c640) at ../sysdeps/unix/sysv/linux/sigsuspend.c:30
#1 0x00000000005e71e4 in ?? ()
#2 0x00000000005e742d in ?? ()
#3 <signal handler called>
#4 pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:183
#5 0x0000000000629f41 in ?? ()
#6 0x000000000063fca4 in ?? ()
#7 0x000000000059c3c7 in ?? ()
#8 0x000000000059d686 in ?? ()
#9 0x00000000407ca098 in ?? ()
#10 0x0000000001bd2648 in ?? ()
#11 0xffffffffffffffff in ?? ()
#12 0x7fffffffffffffff in ?? ()
#13 0x00007fe93e299fe0 in ?? ()
#14 0x0000000000000000 in ?? ()
Thread 3 (Thread 0x7fe93e69b700 (LWP 23013)):
#0 0x00007fe93ef6b867 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x97c100) at ../sysdeps/unix/sys v/linux/futex-internal.h:205
#1 do_futex_wait (sem=sem@entry=0x97c100, abstime=0x0) at sem_waitcommon.c:111
#2 0x00007fe93ef6b914 in __new_sem_wait_slow (sem=0x97c100, abstime=0x0) at sem_waitcommon.c:181
#3 0x00007fe93ef6b9ba in __new_sem_wait (sem=<optimized out>) at sem_wait.c:29
#4 0x00000000005bb8f9 in ?? ()
#5 0x000000000059c68c in ?? ()
#6 0x0000000000653b4c in ?? ()
#7 0x00007fe93ef636fa in start_thread (arg=0x7fe93e69b700) at pthread_create.c:333
#8 0x00007fe93ea7ab5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 2 (Thread 0x7fe93dfff700 (LWP 23012)):
#0 pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1 0x0000000000623a27 in ?? ()
#2 0x00007fe93ef636fa in start_thread (arg=0x7fe93dfff700) at pthread_create.c:333
#3 0x00007fe93ea7ab5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 1 (Thread 0x7fe93fa9a740 (LWP 23011)):
#0 0x00007fe93ef6cfbb in __waitpid (pid=6096, stat_loc=0x7fe93fab211c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1 0x00000000004acd59 in ?? ()
#2 0x00000000005040fe in ?? ()
#3 0x00000000004275d7 in ?? ()
#4 <signal handler called>
#5 0x0000000000603d29 in ?? ()
#6 0x000000000060789b in ?? ()
#7 0x0000000000607f5c in ?? ()
#8 0x00000000005fb80d in ?? ()
#9 0x00000000005e8da1 in ?? ()
#10 0x00000000005c5025 in ?? ()
#11 0x0000000000597899 in ?? ()
#12 0x00000000407798d2 in ?? ()
#13 0x00007fe93e000650 in ?? ()
#14 0x00007fe93e000670 in ?? ()
#15 0x00007fe93e25ffd0 in ?? ()
#16 0x0000000000000023 in ?? ()
#17 0x0000000000000021 in ?? ()
#18 0x0000000001854b00 in ?? ()
#19 0x00007fe93a1bf920 in ?? ()
#20 0x00007ffc3993cac0 in ?? ()
#21 0x00007ffc3993c950 in ?? ()
#22 0x00007fe93bdcc6ba in string_InternalSubString_int_int (this=0x7fe93e25ffd0, startIndex=35, length=33) from /usr/lib/mono/aot-cache/a md64/mscorlib.dll.so
#23 0x00007fe93bdcc5bc in string_Substring_int_int (this=0x7fe93e25ffd0, startIndex=35, length=33) from /usr/lib/mono/aot-cache/amd64/msc orlib.dll.so
#24 0x00007fe93bdcc52f in string_Substring_int (this=0x7fe93e25ffd0, startIndex=35) from /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so
#25 0x000000004080d6fa in ?? ()
#26 0x00007fe93e3f3e60 in ?? ()
#27 0x000000004081c4b8 in ?? ()
#28 0x00007fe93e3f3e60 in ?? ()
#29 0x00007fe93be2887d in System_Threading_Thread_get_ManagedThreadId (this=...) from /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so
#30 0x00000000408176b3 in ?? ()
#31 0x00007fe93e3fb8a0 in ?? ()
#32 0x00007fe93e3fb8a0 in ?? ()
#33 0x00007fe93e195bc0 in ?? ()
#34 0x000000004081c3d3 in ?? ()
#35 0x00007fe93e3fb8a0 in ?? ()
#36 0x0000000040812e80 in ?? ()
#37 0x00007fe93e000650 in ?? ()
#38 0x00007fe93e3fb8a0 in ?? ()
#39 0x0000000001b38e18 in ?? ()
#40 0x00007fe93e195bc0 in ?? ()
#41 0x00007fe93e3d7040 in ?? ()
#42 0x0000000001b38e18 in ?? ()
#43 0x00007fe93e195bc0 in ?? ()
#44 0x00007fe93e3d7040 in ?? ()
#45 0x00007ffc3993cca0 in ?? ()
#46 0x000000004081c284 in ?? ()
#47 0x00007fe93e000688 in ?? ()
#48 0x00007fe93e0c9de8 in ?? ()
#49 0x00007fe93e000670 in ?? ()
#50 0x00007fe93b6832b0 in ?? ()
#51 0x00007fe93b6349b8 in ?? ()
#52 0x000000004081b378 in ?? ()
#53 0x00007ffc3993d130 in ?? ()
#54 0x00007ffc3993cca0 in ?? ()
#55 0x00007fe93a1b3630 in ?? ()
#56 0x00007fe93a1b3630 in ?? ()
#57 0x00007fe93e0c9de8 in ?? ()
#58 0x00007fe93e000670 in ?? ()
#59 0xffffffffffffffff in ?? ()
#60 0x0000000000000000 in ?? ()
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Aborted (core dumped)