ust-consumerd: fix exit race log corruption
authorJason Wessel <jason.wessel@windriver.com>
Wed, 27 Apr 2011 20:22:15 +0000 (22:22 +0200)
committerNils Carlson <nils.carlson@ericsson.com>
Thu, 28 Apr 2011 13:17:19 +0000 (15:17 +0200)
commitebb0b9c112a0583504922a9451571b648d67a6de
treec3a6849b3ba0f91025bf47af1edf1c4d82e90638
parent5343b2860738c675311ce5949bdf9e31afc76fa4
ust-consumerd: fix exit race log corruption

In the following scenario on an SMP system the ust-consumerd can end
up not properly closing out file handles which leads to log
corruption:
  * usttrace -m -l small_quick_app_lots_of_malloc_and_free
  * The app completes and usttrace sees and sends the SIGTERM to ust-consumerd
  * The ust-consumerd main thread will exit and the _exit() handlers
    kills off the remaining pthreads without everything getting closed out

The solution to the problem is to introduce an active_thread count for
the private ustconsumer_instance.  This counter will be zeroed out
when it is safe to completely shutdown the main thread, which will
subsequently run the _exit() handlers.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
include/ust/ustconsumer.h
libustconsumer/libustconsumer.c
This page took 0.023225 seconds and 4 git commands to generate.