[haiku-commits] Re: haiku: hrev45507 - src/add-ons/kernel/network/notifications

  • From: Rene Gollent <anevilyak@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 15 Apr 2013 21:26:50 -0400

On 4/15/13, Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> The constructor of the parent class, DefaultNotificationService, registers
> the object with the NotificationManager, which acquires a reference. That's
> not exactly nice -- there's a theoretical race condition, the object being
> publicly accessible before being fully constructed (though that's probably
> harmless).

While your analysis was overall indeed the case, unfortunately this
last part winds up biting us a little in some way. Adjusting the code
as suggested, while no longer panicking, does wind up in a deadlock
situation, whether built with debug or release, as illustrated here:

http://imagebin.org/254193

Interestingly, when UnregisterService calls ReleaseReference, the base
class version of LastReferenceReleased seems to get called rather than
the overridden version that NetNotificationService defines, resulting
an attempt to delete the object, which leads to a double lock. Not
sure what to do about that one at the moment, so I've pulled that
ReleaseReference() call back out for now since we're otherwise
unbootable.

Regards,

Rene

Other related posts: