bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bugs #8374] NSNotificationCenter can deadlock


From: Richard Frith-Macdonald
Subject: [bugs #8374] NSNotificationCenter can deadlock
Date: Wed, 31 Mar 2004 08:27:01 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040312 Debian/1.6-3

This mail is an automated notification from the bugs tracker
 of the project: GNUstep.

/**************************************************************************/
[bugs #8374] Latest Modifications:

Changes by: 
                Richard Frith-Macdonald <rfm@gnu.org>
'Date: 
                Wed 03/31/04 at 13:26 (GMT)

            What     | Removed                   | Added
---------------------------------------------------------------------------
          Resolution | None                      | Fixed
              Status | Open                      | Closed


------------------ Additional Follow-up Comments ----------------------------
We use DO and notifications in a threaded environment (inside java servlet 
engine) where I work, so a possible deadlock there is potentially a serious 
issue for us ... so I spent a
bit of company time on this.

I've rewritten the notification posting code to post when the center is 
unlocked (and also simplified it a bit).  This seems to fix your problem and I 
haven't had any other trouble with it.
Please can you try it out (the changes are in CVS now) and let me know if I've 
introduced any other bugs :-)






/**************************************************************************/
[bugs #8374] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=8374>
Project: GNUstep
Submitted by: Willem Rein Oudshoorn
On: Tue 03/30/04 at 13:13

Category:  Base/Foundation
Severity:  3 - Ordinary
Item Group:  Bug
Resolution:  Fixed
Assigned to:  None
Status:  Closed


Summary:  NSNotificationCenter can deadlock

Original Submission:  There is a lock protecting the list of notifications.  
This lock is grabbed before sending the notifications and released after 
sending the notifications.  

This can lead to a deadlock when multiple threads are using the notification 
center.   The attached program shows in a very artificial situation how the 
deadlock can occur.  

I just spend 3 days figuring this out in a complicated situation involving 
multiple threads, DO and launched tasks.  
So it is not just a theoretical problem.

I have not looked deeply at it, but probably just
making a copy instead of maintaining the lock will solve it.
(But I have to look again.)


Wim Oudshoorn

Follow-up Comments
------------------


-------------------------------------------------------
Date: Wed 03/31/04 at 13:26         By: CaS
We use DO and notifications in a threaded environment (inside java servlet 
engine) where I work, so a possible deadlock there is potentially a serious 
issue for us ... so I spent a
bit of company time on this.

I've rewritten the notification posting code to post when the center is 
unlocked (and also simplified it a bit).  This seems to fix your problem and I 
haven't had any other trouble with it.
Please can you try it out (the changes are in CVS now) and let me know if I've 
introduced any other bugs :-)






File Attachments
-------------------

-------------------------------------------------------
Date: Tue 03/30/04 at 13:13  Name: deadlocktest.tar.gz  Size: 837KB   By: wim
Example of NSNotificationCenter deadlock.  
http://savannah.gnu.org/bugs/download.php?item_id=8374&amp;item_file_id=1143






For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=8374>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]