Skip to content

Assignment5 and 6 does NOT wait for the process to terminate #39

@EsGeh

Description

@EsGeh

The way I see it this code does not do what it is supposed to.

echo "Waiting for aesdsocket application with pid $PID to terminate"
wait_exit=1
while [ $wait_exit -ne 0 ]; do
kill -0 ${PID}
wait_exit=$?
if [ $wait_exit -ne 0 ]; then
ps -q $PID | grep "defunct"
wait_exit=$?
if [ $wait_exit -ne 0 ]; then
echo "aesdsocket still running"
sleep 1
fi
fi
done

Expected Behaviour:

The test should wait until the demonized server with pid ${PID} has finished.

Actual Behaviour:

In case the process is still running, the first kill -0 ${PID} in Line 522 succeeds and the loop stops.
The test continues with the demon still running...

Why is this a problem:

This causes an issue if the server takes longer to shutdown.
The demonized server is still running and might not yet have deleted the temp file /tmp/aesdsocketdata.
This may cause the following valgrind tests to fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions