mail-archives/mono-osx/2011-February/003917.html

211 строки
8.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-osx] Process.Start causes SIGSEGV
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20Process.Start%20causes%20SIGSEGV&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="003936.html">
<LINK REL="Next" HREF="003920.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-osx] Process.Start causes SIGSEGV</H1>
<B>Chu</B>
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20Process.Start%20causes%20SIGSEGV&In-Reply-To="
TITLE="[Mono-osx] Process.Start causes SIGSEGV">rscott at computerlabsolutions.com
</A><BR>
<I>Tue Feb 1 10:53:53 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="003936.html">[Mono-osx] Apple Application Tools
</A></li>
<LI>Next message: <A HREF="003920.html">[Mono-osx] Mono 2.10 RC2
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3917">[ date ]</a>
<a href="thread.html#3917">[ thread ]</a>
<a href="subject.html#3917">[ subject ]</a>
<a href="author.html#3917">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>
Mono version: 2.8.2
OS: MacOSX Snow Leopard
I've got a simple process running on MacOSX that checks for Idle time. It
uses ProcessStart to execute a command and read in the output generated by
it.
After running this small process about 250 times, Mono crashes with a
SIGSEGV and the following dump. Additionally, the code doesn't seem to be
trappable. Mono ignores the try/catch and dies either way.
Is there a way around this? Is it a known problem in mono?
Stacktrace:
at (wrapper managed-to-native)
System.Diagnostics.Process.CreateProcess_internal
(System.Diagnostics.ProcessStartInfo,intptr,intptr,intptr,System.Diagnostics.Process/ProcInfo&amp;)
&lt;0x00003&gt;
at (wrapper managed-to-native)
System.Diagnostics.Process.CreateProcess_internal
(System.Diagnostics.ProcessStartInfo,intptr,intptr,intptr,System.Diagnostics.Process/ProcInfo&amp;)
&lt;0x00003&gt;
at System.Diagnostics.Process.Start_noshell
(System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process) &lt;0x0083b&gt;
at System.Diagnostics.Process.Start_common
(System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process) &lt;0x000e9&gt;
at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo)
&lt;0x00053&gt;
at IdleTimeMacConsole.Program.getIdleTimeMethod1 () &lt;0x000a2&gt;
at IdleTimeMacConsole.Program.pollPowerChange (object) &lt;0x0000a&gt;
at System.Threading.Timer/Scheduler/&lt;SchedulerThread&gt;c__AnonStorey3.&lt;&gt;m__6
(object) &lt;0x00060&gt;
at (wrapper runtime-invoke) &lt;Module&gt;.runtime_invoke_void__this___object
(object,intptr,intptr,intptr) &lt;0x00041&gt;
Native stacktrace:
0 mono 0x000c96ef
mono_handle_native_sigsegv + 343
1 mono 0x00010519
mono_sigsegv_signal_handler + 306
2 libSystem.B.dylib 0x911db46b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 mono 0x00241c58 _wapi_handle_unref + 159
5 mono 0x002424d5 CloseHandle + 93
6 mono 0x001e7a9a
ves_icall_System_Diagnostics_Process_CreateProcess_internal + 1343
7 ??? 0x0066170e 0x0 + 6690574
8 ??? 0x006606fc 0x0 + 6686460
9 ??? 0x0065fd4a 0x0 + 6683978
10 ??? 0x0065fa74 0x0 + 6683252
11 ??? 0x0065f583 0x0 + 6681987
12 ??? 0x0065f48b 0x0 + 6681739
13 ??? 0x0065f451 0x0 + 6681681
14 ??? 0x004cfc02 0x0 + 5045250
15 mono 0x000102e4 mono_jit_runtime_invoke
+ 1339
16 mono 0x001df415 mono_runtime_invoke +
138
17 mono 0x001e0542
mono_runtime_delegate_invoke + 111
18 mono 0x00217f19 mono_async_invoke + 148
19 mono 0x0021a717 async_invoke_thread +
749
20 mono 0x0021c49b start_wrapper + 600
21 mono 0x0025a2bb thread_start_routine +
194
22 mono 0x0028b813 GC_start_routine + 107
23 libSystem.B.dylib 0x911a285d _pthread_start + 345
24 libSystem.B.dylib 0x911a26e2 thread_start + 34
Debug info from gdb:
=================================================================
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.
=================================================================
To reproduce this problem, create a console app with the following code:
static void Main(string[] args) {
Timer pollTimer = new Timer(new TimerCallback(pollPowerChange),
null, new TimeSpan(0, 0, 0), TimeSpan.FromMilliseconds(500));
var run = true;
while (run) {
var key = Console.ReadKey();
if (key.Key == ConsoleKey.Q) {
run = false;
}
}
}
private static void pollPowerChange(object ignore){
Console.WriteLine(string.Format(&quot;Idle Time: {0}&quot;,
getIdleTimeMethod1()));
}
private static double getIdleTimeMethod1() {
try {
// Initialize to a value that we are guranteed to find a
idle time less than.
Int64 idle = Int64.MaxValue;
// Run ioreg to get a whole slew of information.
ProcessStartInfo ioregInfo = new ProcessStartInfo(&quot;ioreg&quot;,
&quot;-c IOHIDSystem&quot;);
ioregInfo.UseShellExecute = false;
ioregInfo.RedirectStandardOutput = true;
using (var ioreg = Process.Start(ioregInfo)) {
// Look for the parts that have to do with Idle Time,
and pick the lowest one.
foreach (Match match in
Regex.Matches(ioreg.StandardOutput.ReadToEnd(), @&quot;&quot;&quot;HIDIdleTime&quot;&quot; = (\d+)&quot;))
{
Int64 val = Int64.Parse(match.Groups[1].Value);
if (val &lt; idle) {
idle = val;
}
}
// Convert the value to seconds.
idle = idle / 1000000000;
}
return new TimeSpan(0, 0, (int)idle).TotalSeconds;
} catch {
return -1;
}
}
--
View this message in context: <A HREF="http://mono.1490590.n4.nabble.com/Process-Start-causes-SIGSEGV-tp3251954p3251954.html">http://mono.1490590.n4.nabble.com/Process-Start-causes-SIGSEGV-tp3251954p3251954.html</A>
Sent from the Mono - OSX mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="003936.html">[Mono-osx] Apple Application Tools
</A></li>
<LI>Next message: <A HREF="003920.html">[Mono-osx] Mono 2.10 RC2
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3917">[ date ]</a>
<a href="thread.html#3917">[ thread ]</a>
<a href="subject.html#3917">[ subject ]</a>
<a href="author.html#3917">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
mailing list</a><br>
</body></html>