Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 653599 Details for
Bug 880682
pcp - pmlogger service - race condition
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch against pmie/pmlogger rc.d scripts
bz880682.patch (text/plain), 5.06 KB, created by
Frank Ch. Eigler
on 2012-11-28 16:19:56 UTC
(
hide
)
Description:
patch against pmie/pmlogger rc.d scripts
Filename:
MIME Type:
Creator:
Frank Ch. Eigler
Created:
2012-11-28 16:19:56 UTC
Size:
5.06 KB
patch
obsolete
>amended subset of commit 26129ab3fc91a77aefa3c2807c2b49dec4631036 >Author: Nathan Scott <nathans@redhat.com> >Date: Wed Nov 28 14:30:31 2012 +1100 > > Fix race conditions in pmie and pmlogger startup scripts > > Recent changes to tempfile handling has regressed the pmie and > pmlogger startup scripts. Errors of the form: > /etc/rc.d/init.d/pmlogger: line 100: /var/tmp/pcp.5vfQsSHKo/pmcheck: No such file or directory > are now produced. > > Because sections of these two scripts are run in parallel with > the original script, we are open to race conditions where the > main script exits and removes the temporary directory before the > co-process has an opportunity to create its temporary file. We > can resolve this using separate temporary dirs and trap handling > which thus no longer race. > > Worse still, QA failed to detect the problem. At least one test > that should have found the problem trivially (575) failed to, as > a result of aggressively discarding stderr and stdout instead of > using filtering. This has been rectified and common pmie filter > routines abstracted (from tests 115, 504 and 575) to simplify the > task for all current and future tests. > >diff --git pmie.orig pmie >index bcb0ba7..698c45a 100644 >--- pmie.orig >+++ pmie >@@ -1,5 +1,6 @@ > #!/bin/sh > # >+# Copyright (c) 2012 Red Hat. > # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. > # > # This program is free software; you can redistribute it and/or modify it >@@ -109,37 +110,48 @@ _reboot_setup() > [ ! -d "$LOGDIR" ] && mkdir -p "$LOGDIR" && chown pcp:pcp "$LOGDIR" > } > >+# Note: _start_pmie is running in the background, in parallel with >+# the rest of the script. It might complete well after the caller >+# so tmpfile handling is especially problematic. Goal is to speed >+# bootup by starting potentially slow (remote monitoring) processes >+# in the background. >+# > _start_pmie() > { >+ bgstatus=0 >+ bgtmp=`mktemp -d /var/tmp/pcp.XXXXXXXXX` || exit 1 >+ trap "rm -rf $bgtmp; exit \$bgstatus" 0 1 2 3 15 >+ > wait_option='' > [ ! -z "$PMCD_WAIT_TIMEOUT" ] && wait_option="-t $PMCD_WAIT_TIMEOUT" > > if pmcd_wait $wait_option > then >- pmie_check >$tmp/pmie 2>&1 >- if [ -s $tmp/pmie ] >+ pmie_check >$bgtmp/pmie 2>&1 >+ bgstatus=$? >+ if [ -s $bgtmp/pmie ] > then > pmpost "pmie_check start failed in $prog, mailing output to root" > if [ ! -z "$MAIL" ] > then >- $MAIL -s "pmie_check start failed in $prog" root <$tmp/pmie >/dev/null 2>&1 >+ $MAIL -s "pmie_check start failed in $prog" root <$bgtmp/pmie >/dev/null 2>&1 > else > echo "$prog: pmie_check start failed ..." >- cat $tmp/pmie >+ cat $bgtmp/pmie > fi > fi >- rm -f $tmp/pmie > else >- status=$? >- pmpost "pmcd_wait failed in $prog: exit status: $status" >+ bgstatus=$? >+ pmpost "pmcd_wait failed in $prog: exit status: $bgstatus" > if [ ! -z "$MAIL" ] > then >- echo "pmcd_wait: exit status: $status" | $MAIL -s "pmcd_wait failed in $prog" root >+ echo "pmcd_wait: exit status: $bgstatus" | $MAIL -s "pmcd_wait failed in $prog" root > else > echo "$prog: pmcd_wait failed ..." >- echo "pmcd_wait: exit status: $status" >+ echo "pmcd_wait: exit status: $bgstatus" > fi > fi >+ exit $bgstatus # co-process is now complete > } > > _shutdown() >diff --git pmlogger.orig pmlogger >index 6f9949f..84f3382 100644 >--- pmlogger >+++ pmlogger >@@ -1,5 +1,6 @@ > #!/bin/sh > # >+# Copyright (c) 2012 Red Hat. > # Copyright (c) 2000-2008 Silicon Graphics, Inc. All Rights Reserved. > # > # This program is free software; you can redistribute it and/or modify it >@@ -12,10 +13,6 @@ > # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License > # for more details. > # >-# You should have received a copy of the GNU General Public License along >-# with this program; if not, write to the Free Software Foundation, Inc., >-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-# > # Start or Stop the Performance Co-Pilot pmlogger processes. > # > # The following is for chkconfig on RedHat based systems >@@ -95,21 +92,32 @@ in > ;; > esac > >+# Note: _start_pmcheck() runs in the background, in parallel with >+# the rest of the script. It might complete well after the caller >+# so tmpfile handling is especially problematic. Goal is to speed >+# bootup by starting potentially slow (remote monitoring) pmlogger >+# processes in the background. >+# > _start_pmcheck() > { >- pmlogger_check $VFLAG >$tmp/pmcheck 2>&1 >- if [ -s $tmp/pmcheck ] >+ bgstatus=0 >+ bgtmp=`mktemp -d /var/tmp/pcp.XXXXXXXXX` || exit 1 >+ trap "rm -rf $bgtmp; exit \$bgstatus" 0 1 2 3 15 >+ >+ pmlogger_check $VFLAG >$bgtmp/pmcheck 2>&1 >+ bgstatus=$? >+ if [ -s $bgtmp/pmcheck ] > then > pmpost "pmlogger_check failed in $prog, mailing output to root" > if [ ! -z "$MAIL" ] > then >- $MAIL -s "pmlogger_check failed in $prog" root <$tmp/pmcheck >+ $MAIL -s "pmlogger_check failed in $prog" root <$bgtmp/pmcheck > else > echo "$prog: pmlogger_check failed ..." >- cat $tmp/pmcheck >+ cat $bgtmp/pmcheck > fi > fi >- rm -f $tmp/pmcheck >+ exit $bgstatus # co-process is now complete > } > > _start_pmlogger()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 880682
: 653599