[Mono-bugs] [Bug 692247] New: ThreadPool issue

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri May 6 07:21:29 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=692247

https://bugzilla.novell.com/show_bug.cgi?id=692247#c0


           Summary: ThreadPool issue
    Classification: Mono
           Product: MonoTouch
           Version: SVN
          Platform: iPhone
        OS/Version: Apple iOS 4.3
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Runtime
        AssignedTo: gnorton at novell.com
        ReportedBy: matt at miterdale.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=428402)
 --> (http://bugzilla.novell.com/attachment.cgi?id=428402)
Crash log

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24
(KHTML, like Gecko) Chrome/11.0.696.60 Safari/534.24

I have a hard-to-reproduce problem with ThreadPool. I have a complex
multithreaded app that uses a lot of socket comms. In MonoTouch 3.2.6 this did
not occur. In 4.00 and 4.01 I had problem with Socket.BeginConnect but no
problems with ThreadPool (see here:
http://stackoverflow.com/questions/5803114/problem-with-socket-beginconnect-in-monotouch-4-01-was-ok-in-3-2-6).

In 4.02 I get a crash as my app starts on the device - it's fine on the
simulator. This crash happens in debug and release builds. Stack trace of the
thread that crashed:

Thread 7 Crashed:
0   libsystem_kernel.dylib            0x32715a1c __pthread_kill + 8
1   libsystem_c.dylib                 0x329c23b4 pthread_kill + 52
2   libsystem_c.dylib                 0x329babf8 abort + 72
3   TradeClient1                      0x00872344 mono_handle_native_sigsegv
(mini-exceptions.c:2249)
4   TradeClient1                      0x00899c20 sigabrt_signal_handler
(mini-posix.c:195)
5   libsystem_c.dylib                 0x329cd728 _sigtramp + 36
6   libsystem_c.dylib                 0x329c23b4 pthread_kill + 52
7   libsystem_c.dylib                 0x329babf8 abort + 72
8   TradeClient1                      0x009af1a0 monoeg_g_logv (goutput.c:133)
9   TradeClient1                      0x009af234 monoeg_assertion_message
(goutput.c:154)
10  TradeClient1                      0x00982924 _wapi_handle_unref
(handles.c:1143)
11  TradeClient1                      0x0097fca4 handle_cleanup (handles.c:215)
12  libsystem_c.dylib                 0x329ba902 __cxa_finalize + 154
13  libsystem_c.dylib                 0x329ba84a exit + 6
14  TradeClient1                      0x0096fdc8 async_invoke_thread
(threadpool.c:1444)
15  TradeClient1                      0x009726c8 start_wrapper_internal
(threads.c:782)
16  TradeClient1                      0x009727bc start_wrapper (threads.c:830)
17  TradeClient1                      0x00997348 thread_start_routine
(wthreads.c:285)
18  TradeClient1                      0x009c70a4 GC_start_routine
(pthread_support.c:1468)
19  libsystem_c.dylib                 0x329c230a _pthread_start + 242
20  libsystem_c.dylib                 0x329c3bb4 thread_start + 0

I have tracked this down to the following code that was being called in my
AppDelegate constructor:

public AppDelegate()
{ 
   ThreadPool.QueueUserWorkItem (delegate { 
      Debug.WriteLine("Pre-caching DNS");      
      Dns.GetHostEntry("[a valid dns name]");
      Dns.GetHostEntry("[a valid dns name]"); 
      Dns.GetHostEntry("[a valid dns name]");      
      Dns.GetHostEntry("[a valid dns name]"); 
      Debug.WriteLine("Finished pre-caching DNS"); 
}); }

(I have removed the DNS names as they relate to proprietary services.)

If I move this to the start of the FinishedLaunching method, it seems to work
OK. But, I have tried to wrap this in a tiny sample app to demonstrate the
problem - and I no longer experience the crash whether it is in the AppDelegate
constructor or in FinishedLaunching.

In the sample app I also tried launching 100 different ThreadPool tasks, to try
and stimulate the crash, with no success.

The full crash log from my device is attached.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list