100% CPU load

Rusty Russell rusty at rustcorp.com.au
Wed Jan 13 00:17:43 MST 2010

On Wed, 13 Jan 2010 03:02:58 am Stefan (metze) Metzmacher wrote:
> Rusty Russell schrieb:
> Hi Ronnie,
> >> I've found another problem with ctdbd spinning
> >> with 100% CPU load reading 0 bytes from the log child.
> Here're the fixes for the spinning.
> The problem were the dup2() call in the wrong direction, which implicit
> closed the stdout.
> git pull git://git.samba.org/metze/ctdb/wip.git master-for-ronnie

Thanks for tracking this down.  I hate to look a gift horse in the mouth,
but you didn't mention this fix in the git log at all!!

And there are still issues with this code.  I agree that dup2() in the child
is simpler, but it was done so we had error handing for the dup2 failing.
I'd like that back but there's no good way, really: the child can exit, or
use YA pipe to report failure.

Also, this function was carefully written to have a valid errno if it failed.
You cannot call close() without saving errno :(

Reintroducing the code in ctdb_set_child_logging() seems really weird to me.
I don't think it adds anything does it?  Setting close on exec is probably
right though...

Note: ctdb_set_child_logging should now be called ctdb_set_logging, since
children have their own separate pipes setup: this captures stdout/stderr from
the main process for logging, mainly.


More information about the samba-technical mailing list