[Mono-bugs] [Bug 556183] New: [Patch] Mac event pump can cause Control.BeginInvoke to block

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 17 11:12:48 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=556183#c0

           Summary: [Patch] Mac event pump can cause Control.BeginInvoke
                    to block
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86-64
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: adrian.taylor at realvnc.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Created an attachment (id=327942)
 --> (http://bugzilla.novell.com/attachment.cgi?id=327942)
Test case

Description of Problem:

Control.BeginInvoke is supposed to queue a message for asynchronous execution
on the main thread. It's supposed to return immediately as per the Microsoft
documentation here:
http://msdn.microsoft.com/en-us/library/0b1bf3y3.aspx

But under some circumstances, on the Mac platform, it can block indefinitely.
This occurs because the Carbon XplatUICarbon.GetMessage function attempts to
act upon messages whilst still holding the message queue lock. This means any
calls to BeginInvoke block until the action is finished. This is causing a
deadlock in our application.

Steps to reproduce the problem:
1. Run attached test case, test.cs
2. Click the "Press here" button

Actual Results:

1. On Mono Linux (Ubuntu 9.04 x86_64, version 2.0.1) the test prints "All OK!"
twice and the form remains responsive.
2. On Mono MacOS X.6 x86_64 (version 2.4.2.3) the test does not print that, and
the UI thread blocks indefinitely.

Expected Results:

UI thread unblocks and application remains responsive.

How often does this happen? 

100% reproducible.


Output under Linux:
Main thread - about to create secondary thread
Secondary thread - created
Main thread: UI thread callback 1 taking place - claiming mutex
Secondary thread - About to BeginInvoke cb2 - if this blocks, it's a bug!
Secondary thread - Finished BeginInvoke cb2
Secondary thread - exiting - all OK!
Main thread: UI thread callback 2 taking place - all OK!


Output under MacOS X:

Main thread - about to create secondary thread
Secondary thread - created
Main thread: UI thread callback 1 taking place - claiming mutex
Secondary thread - About to BeginInvoke cb2 - if this blocks, it's a bug!


Additional Information:

I have attempted to make a patch, which I will attach after I've submitted
this. However I have not tested this - I am struggling to get Mono to build.
It's just my best guess at where the problem lies.


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


More information about the mono-bugs mailing list