Skip to contentSkip to conversation

improved process management

PATCH In review Ed Bartosh 2 participants 5 messages Aug 31, 2016 – Sep 2, 2016

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

v2 cover improved process management

Hi,

This is a set of small improvements for process management in toaster script and a fix for bug #7973

Changes in v2: Had to remove usage of user and pid namespaces as it's not supported
in some distros.

The following changes since commit 34ccad16d40ec0685f405b8d7116250fb58e323d:

buildinfohelper: discover kernel artifacts correctly (2016-08-23 14:29:32 +0300)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib ed/toaster/kill-toaster-7973
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/kill-toaster-7973

Ed Bartosh (3):
toaster: don't kill toaster on start
toaster: remove handling of .toasterui.pid
toaster: don't kill all runserver processes

 bitbake/bin/toaster | 15 ---------------
 1 file changed, 15 deletions(-)

--
Regards,
Ed

author
#1 lore raw

PATCH v2 1/3 toaster: don't kill toaster on start

There is no point of trying to kill django development server when toaster starts because 'manage.py checksocket' command is already used in the script code to check if development server port is occupied.

Even if Toaster is listening on another port, killing previous instance looks quite implicit and doesn't solve anything as there are other processes that might be still running.

---
 bitbake/bin/toaster | 8 --------
 1 file changed, 8 deletions(-)
bitbake/bin/toaster +0 -8
index e35bfce..5e01101 100755
@@ -249,14 +249,6 @@ case $CMD in
             fi
         fi
 
-        # kill Toaster web server if it's alive
-        if [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then
-            echo "Warning: bitbake appears to be dead, but the Toaster web server is running." 1>&2
-            echo " Something fishy is going on." 1>&2
-            echo "Cleaning up the web server to start from a clean slate."
-            webserverKillAll
-        fi
-
         # Create configuration file
         conf=${BUILDDIR}/conf/local.conf
         line='INHERIT+="toaster buildhistory"'
Signature · 1 line
2.6.6
author
#2 lore raw

PATCH v2 2/3 toaster: remove handling of .toasterui.pid

In reply to Ed Bartosh

This file is not created anywhere, but handled in toaster script code.

---
 bitbake/bin/toaster | 4 ----
 1 file changed, 4 deletions(-)
bitbake/bin/toaster +0 -4
index 5e01101..b14749a 100755
@@ -95,10 +95,6 @@ stop_system()
     # prevent reentry
     if [ $INSTOPSYSTEM -eq 1 ]; then return; fi
     INSTOPSYSTEM=1
-    if [ -f ${BUILDDIR}/.toasterui.pid ]; then
-        kill `cat ${BUILDDIR}/.toasterui.pid` 2>/dev/null
-        rm ${BUILDDIR}/.toasterui.pid
-    fi
     webserverKillAll
     # unset exported variables
     unset TOASTER_DIR
Signature · 1 line
2.6.6
author
#3 lore raw

PATCH v2 3/3 toaster: don't kill all runserver processes

In reply to Ed Bartosh

Toaster script kills runserver process 2 ways:
- sending signal to pid from .toastermain.pid.
- sending signal to pids found by grepping ps output:
ps fux | grep "python.*manage.py runserver"

Second approach is redundant and harmfull as it kills all django development server running on the machine.

[YOCTO #7973]

---
 bitbake/bin/toaster | 3 ---
 1 file changed, 3 deletions(-)
bitbake/bin/toaster +0 -3
index b14749a..6641dbc 100755
@@ -33,9 +33,6 @@ webserverKillAll()
             while kill -0 $pid 2>/dev/null; do
                 kill -SIGTERM -$pid 2>/dev/null
                 sleep 1
-                # Kill processes if they are still running - may happen
-                # in interactive shells
-                ps fux | grep "python.*manage.py runserver" | awk '{print $2}' | xargs kill
             done
             rm  ${pidfile}
         fi
Signature · 1 line
2.6.6
#4 lore raw
In reply to Ed Bartosh
Quoted 15 lines · On 31/08/2016 12:54, "[email protected] on behalf of Ed…

Hi,

This is a set of small improvements for process management in toaster script and a fix for bug #7973

Changes in v2: Had to remove usage of user and pid namespaces as it's not supported
in some distros.

The following changes since commit
34ccad16d40ec0685f405b8d7116250fb58e323d:

buildinfohelper: discover kernel artifacts correctly (2016-08-23
14:29:32 +0300)

Quoted 6 lines

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib ed/toaster/kill-toaster-7973

http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/kill-t
oaster-7973

This seems to be working for me. With 2 toaster instances running on the same machine, I can now stop one of them without the other being killed.

Thanks!

Belén

Quoted 18 lines

Ed Bartosh (3):
toaster: don't kill toaster on start
toaster: remove handling of .toasterui.pid
toaster: don't kill all runserver processes

bitbake/bin/toaster | 15 ---------------

1 file changed, 15 deletions(-)

--
Regards,
Ed

Signature · 4 lines
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster