/etc/init.d/stud restart does not start the daemon
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
stud (Ubuntu) |
Fix Released
|
Medium
|
Louis Bouchard | ||
Precise |
Fix Released
|
Medium
|
Louis Bouchard | ||
Quantal |
Fix Released
|
Medium
|
Louis Bouchard | ||
Raring |
Fix Released
|
Medium
|
Louis Bouchard | ||
Saucy |
Fix Released
|
Medium
|
Louis Bouchard |
Bug Description
SRU justification :
Impact :
When using invoke-rc.d stud restart, stud is not restarted
since the children processes are still holding open sockets since children are not
killed when SIGTERM is sent to the parent
Fix :
Modify stud to handle termination of children upon reception of SIGTERM
Test Case :
1) Install stud
2) Create SSL certs with the following cmds:
$ openssl genrsa -des3 -passout pass:ubuntu -out server.key 2048
$ openssl rsa -passin pass:ubuntu -in server.key -out server.key.insecure
$ mv server.key server.key.secure
$ mv server.key.insecure server.key
$ openssl req -new -key server.key -out server.csr -subj "/C=FR/
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
$ cp server.crt /etc/ssl/certs
$ cp server.key /etc/ssl/private
$ openssl req -new -x509 -nodes -keyout /etc/stud/stud.pem -out /etc/stud/stud.pem -days 3650 -subj "/C=FR/
3) configure stud :
$ cat << EOF > /etc/stud/stud.conf
OPTIONS="-b 127.0.0.1,8445"
CERT="/
EOF
4) Start stud
$ sudo invoke-rc.d stud start
One parent and one child stud process should be present
5) Restart stud
$ sudo invoke-rc.d stud restart
With the fix, stud parent and child process will be restarted. Without the fix, no more
stud process will be present.
Regression :
Minimal. Signal handler is enable for the parent process only. Triggered if
SIGTERM is received by the parent.
Original description of the problem :
I guess it is a race condition, as
/etc/init.d/stud stop; /etc/init.d/stud start
shows the same problem while adding a "sleep 1" before the call to "do_start" fixes the problem.
There is also a (unrelated) bug in the function "do_stop()": there is a variable
notfound=1
but it is not set to "0" in the for loop (as is the case in 'do_start'). This causes the return value to be 1:
[ $notfound -eq 1 ] && return 1
But this has nothing to do with the restart problem as both return values 0 and 1 are in the same case statement, so no difference to program flow.
Changed in stud (Ubuntu): | |
status: | New → Triaged |
Changed in stud (Ubuntu Precise): | |
status: | New → Triaged |
Changed in stud (Ubuntu): | |
assignee: | nobody → Louis Bouchard (louis-bouchard) |
Changed in stud (Ubuntu Precise): | |
assignee: | nobody → Louis Bouchard (louis-bouchard) |
Changed in stud (Ubuntu): | |
status: | Triaged → Fix Released |
Changed in stud (Ubuntu): | |
status: | Fix Released → In Progress |
importance: | Undecided → Medium |
description: | updated |
tags: |
added: verification-done removed: verification-needed |
Can engineering please evaluate the simple patch proposed here, which adds a sleep 1 to the restart clause, fixing the problem on stud?
thanks,
Eduardo.