[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: [espie@nerim.net: PATCH: fix nasty race condition in core
From: Waldo Bastian <bastian () kde ! org>
Date: 2005-01-31 22:41:39
Message-ID: 200501312341.43504.bastian () kde ! org
[Download RAW message or body]
Please commit.
Cheers,
Waldo
On Monday 31 January 2005 20:37, Marc Espie wrote:
> Prompted by Stephen Kulow...
>
> ----- Forwarded message from Marc Espie <espie@nerim.net> -----
>
> Date: Sat, 29 Jan 2005 14:29:09 +0100
> From: Marc Espie <espie@nerim.net>
> To: kde-devel@kde.org
> Subject: PATCH: fix nasty race condition in core libraries
>
> I've finally found out why kded crashes frequently when one starts
> konqueror directly on OpenBSD.
>
> It's because of the following race condition.
>
> For some reason, it doesn't happen (or doesn't happen that often) under
> other OSes, but it is fairly deadly. Having setupHandlers in the
> KProcessController constructor means the sigchild handler may get called
> before theKProcessController has finished building, and the ::write ends
> in a segfault.
>
> Under OpenBSD, the way threads are implemented mean the SIGCHLD happens
> right away when we do the sigprocmask, whereas for other OSes it might
> happen infrequently.
>
> I'd like to commit this before the new KDE gets released...
>
> Any objection ?
>
> Index: kprocctrl.cpp
> ===================================================================
> RCS file: /home/kde/kdelibs/kdecore/kprocctrl.cpp,v
> retrieving revision 1.59
> diff -u -p -u -p -r1.59 kprocctrl.cpp
> --- kprocctrl.cpp 7 Sep 2004 11:42:17 -0000 1.59
> +++ kprocctrl.cpp 29 Jan 2005 11:32:46 -0000
> @@ -39,7 +39,10 @@ int KProcessController::refCount;
> void KProcessController::ref()
> {
> if( !refCount )
> + {
> theKProcessController = new KProcessController;
> + setupHandlers();
> + }
> refCount++;
> }
>
> @@ -71,7 +74,6 @@ KProcessController::KProcessController()
> QObject::connect( notifier, SIGNAL(activated(int)),
> SLOT(slotDoHousekeeping()));
>
> - setupHandlers();
> }
>
> KProcessController::~KProcessController()
>
> ----- End forwarded message -----
--
bastian@kde.org | Free Novell Linux Desktop 9 Evaluation Download
bastian@suse.com | http://www.novell.com/products/desktop/eval.html
[Attachment #3 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic