stop_component infinite loop

Description

infinite loop if check_status returns 0 first time then 1 second time and then checkPid returns 0

I think we need an else for the if [ $__flagPid -eq 1 ] that exits if __flagPid is 0 ?

stopcmd="${START_STOP_DAEMON} -K -p ${PIDPATH} >> tmp.txt 2>&1"

if [ ${DEBUG} != "NO_DEBUG" ]; then
echo "$stopcmd"
fi

eval $stopcmd
check_status ${PIDPATH} ${LOCKPATH} ${COMPPIDPATH} 0
RESULT="$?"

if [ "${RESULT}" -eq 0 ] ; then
while [ 1 ]
do
check_status ${PIDPATH} ${LOCKPATH} ${COMPPIDPATH} 0
RCSTOP=$?
if [ ${RCSTOP} -ne 0 ] ; then
#Before exiting check whether init_<component> is still running or not
while [ 1 ]
do
checkPid ${PIDPATH}
if [ $__flagPid -eq 1 ];then
checkPidExist ${PIDPATH}
if [ $__pidExists -ne 1 ];then
cleanupRuntimeEnvironment
log_success_msg
RCSTOP=0
break 2
fi
fi
sleep 1
done
fi
sleep 1
done

Conclusion

None

Activity

Show:

Michael Gardner March 30, 2015 at 12:45 PM
Edited

The code Mark is referencing here hasn't really changed much at all since before 2011. Ming added a return in 5.0.0 that was needed to exit us out of the internal loop, but the issue with $_flagPid -eq 0 and $_pidExists -eq 1 and getting stuck in an infinite loop has been there since at least 5.0.0.

Mark Kelly March 30, 2015 at 1:23 AM

I do not know. Will check git history and test prior releases to confirm.

Richard Chapman March 28, 2015 at 8:59 AM

Is this a new issue in 5.2.0?

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Components

Assignee

Reporter

Priority

Fix versions

Pull Request URL

Affects versions

Created March 25, 2015 at 6:40 PM
Updated April 2, 2015 at 10:08 AM
Resolved April 2, 2015 at 10:08 AM