bugGNUstep - Bugs: bug #8374, NSNotificationCenter can deadlock

Group
 
 

bug #8374: NSNotificationCenter can deadlock

Submitter:  Willem Rein Oudshoorn <wim>
Submitted:  Tue 30 Mar 2004 01:13:12 PM UTC
   
 
Category:  Base/Foundation Severity:  2 - Minor
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 01 Apr 2004 01:29:49 PM UTC, comment #2: 

Seems to have solved my problems.
About the new bugs, I don't know :-)


Willem Rein Oudshoorn <wim>
Group Member
Wed 31 Mar 2004 01:26:59 PM UTC, comment #1: 

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 :-)

Richard Frith-Macdonald <CaS>
Group Member
Tue 30 Mar 2004 01:13:12 PM UTC, 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

Willem Rein Oudshoorn <wim>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #1161:  deadlocktest.tar.gz added by wim (837B - application/x-gzip - Example of NSNotificationCenter deadlock. )

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-03-31 CaS Open/ClosedOpen Closed
2004-03-31 CaS StatusNone Fixed
2004-03-30 wim Attached File- Added deadlocktest.tar.gz, #1143

Back to the top

Powered by Savane 3.13-4448.
Corresponding source code