Skip to contentSkip to conversation

tcf-agent: Fix daemon termination

PATCH In review Jan Kiszka 4 participants 16 messages Apr 30, 2017 – Jun 13, 2017

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 tcf-agent: Fix daemon termination

From: Jan Kiszka <[email protected]>

The upstream init script uses SIGUSR2 to terminate that daemon because SIGTERM is ignored. As the killproc function does not support specifying a signal, switch to start-stop-daemon. Drop the retry loop because SIGUSR2 is lethal for agent.

---
 meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.init | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.init +1 -10
index 6303280aae..bd602c67cb 100755
@@ -33,16 +33,7 @@ case "$1" in
 
     stop)
         echo -n "Stopping $DAEMON_NAME: "
-        count=0
-        while [ -n "`/bin/pidof $DAEMON_PATH`" -a $count -lt 10 ] ; do
-            killproc $DAEMON_PATH >& /dev/null
-            sleep 1
-            RETVAL=$?
-            if [ $RETVAL != 0 -o -n "`/bin/pidof $DAEMON_PATH`" ] ; then
-                sleep 3
-            fi
-            count=`expr $count + 1`
-        done
+        start-stop-daemon -K -q -x $DAEMON_PATH -s USR2
         rm -f /var/lock/subsys/$DAEMON_NAME
         if [ -n "`/bin/pidof $DAEMON_PATH`" ] ; then
             echo "FAIL"
#1 lore raw
Quoted 8 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

The upstream init script uses SIGUSR2 to terminate that daemon because SIGTERM is ignored. As the killproc function does not support specifying a signal, switch to start-stop-daemon. Drop the retry loop because SIGUSR2 is lethal for agent.

Thanks! I noticed this bug and was planning to look into it, but it looks like you found the issue first! This was bringing shutdowns to a crawl for me.

#2 lore raw
Quoted 8 lines · Martin Kelly
Quoted 7 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

The upstream init script uses SIGUSR2 to terminate that daemon because SIGTERM is ignored. As the killproc function does not support specifying a signal, switch to start-stop-daemon. Drop the retry loop because SIGUSR2 is lethal for agent.

Quoted 5 lines
Quoted 1 line

Thanks! I noticed this bug and was planning to look into it, but it looks like you found the issue first! This was bringing shutdowns to a crawl for me.

I just noticed, I think we need to fix the same bug in the systemd service script too.

#3 lore raw
Quoted 9 lines · Martin Kelly
Quoted 8 lines · Martin Kelly
Quoted 7 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

The upstream init script uses SIGUSR2 to terminate that daemon because SIGTERM is ignored. As the killproc function does not support specifying a signal, switch to start-stop-daemon. Drop the retry loop because SIGUSR2 is lethal for agent.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks! I noticed this bug and was planning to look into it, but it looks like you found the issue first! This was bringing shutdowns to a crawl for me.

I just noticed, I think we need to fix the same bug in the systemd service script too.

OK, I sent a patch to fix the same issue in the systemd service script.

#4 lore raw
In reply to Martin Kelly
Quoted 9 lines · Martin Kelly
Quoted 8 lines · Martin Kelly
Quoted 7 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

The upstream init script uses SIGUSR2 to terminate that daemon because SIGTERM is ignored. As the killproc function does not support specifying a signal, switch to start-stop-daemon. Drop the retry loop because SIGUSR2 is lethal for agent.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks! I noticed this bug and was planning to look into it, but it looks like you found the issue first! This was bringing shutdowns to a crawl for me.

I just noticed, I think we need to fix the same bug in the systemd service script too.

Does this block this patch, or should this be done in a separate one? I noticed that it's still not merged.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 16 lines · Jan Kiszka
Quoted 15 lines · Martin Kelly
Quoted 13 lines · Martin Kelly
Quoted 8 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

The upstream init script uses SIGUSR2 to terminate that daemon because SIGTERM is ignored. As the killproc function does not support specifying a signal, switch to start-stop-daemon. Drop the retry loop because SIGUSR2 is lethal for agent.

Thanks! I noticed this bug and was planning to look into it, but it looks like you found the issue first! This was bringing shutdowns to a crawl for me.

Quoted 6 lines
Quoted 2 lines

I just noticed, I think we need to fix the same bug in the systemd service script too.

Does this block this patch, or should this be done in a separate one? I noticed that it's still not merged.

I sent a separate patch for fixing the systemd issue, so I think we can merge the two patches separately (they're both needed):

https://patchwork.openembedded.org/patch/140355/

Neither of our patches have been merged yet.

#6 lore raw
Quoted 7 lines · Martin Kelly

I sent a separate patch for fixing the systemd issue, so I think we can merge the two patches separately (they're both needed):

https://patchwork.openembedded.org/patch/140355/

Neither of our patches have been merged yet.

Sorry, somehow slipped through the net.

This patch doesn't apply as it's been corrupted by the mailer. Please use git-send-email instead of copy/pasting (I've managed to apply it manually as it's a simple patch this time).

Ross

#7 lore raw
Quoted 10 lines · Ross

On 6 June 2017 at 18:28, Martin Kelly <[email protected] <mailto:[email protected]>> wrote:

I sent a separate patch for fixing the systemd issue, so I think we can merge the two patches separately (they're both needed):

https://patchwork.openembedded.org/patch/140355/
<https://patchwork.openembedded.org/patch/140355/>

Quoted 8 lines

Neither of our patches have been merged yet.

Sorry, somehow slipped through the net.

This patch doesn't apply as it's been corrupted by the mailer. Please use git-send-email instead of copy/pasting (I've managed to apply it manually as it's a simple patch this time).

GnuPG signatures cause troubles... I added to my blacklist.

Sorry,
Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
#8 lore raw
In reply to Burton, Ross
Quoted 13 lines · Ross

On 6 June 2017 at 18:28, Martin Kelly <[email protected] <mailto:[email protected]>> wrote:

I sent a separate patch for fixing the systemd issue, so I think we can merge the two patches separately (they're both needed):

https://patchwork.openembedded.org/patch/140355/
<https://patchwork.openembedded.org/patch/140355/>

Neither of our patches have been merged yet.

Quoted 8 lines

Sorry, somehow slipped through the net.

This patch doesn't apply as it's been corrupted by the mailer. Please use git-send-email instead of copy/pasting (I've managed to apply it manually as it's a simple patch this time).

Ross

Which patch are you referring to? I used git send-email for the systemd patch, and it applies just fine for me on OE-core master (using patch -p1).

#9 lore raw
Quoted 20 lines · Martin Kelly
Quoted 19 lines · Ross

On 6 June 2017 at 18:28, Martin Kelly <[email protected] <mailto:[email protected]>> wrote:

I sent a separate patch for fixing the systemd issue, so I think we can merge the two patches separately (they're both needed):

https://patchwork.openembedded.org/patch/140355/
<https://patchwork.openembedded.org/patch/140355/>

Neither of our patches have been merged yet.

Sorry, somehow slipped through the net.

This patch doesn't apply as it's been corrupted by the mailer. Please use git-send-email instead of copy/pasting (I've managed to apply it manually as it's a simple patch this time).

Quoted 5 lines
Quoted 2 lines

Ross

Which patch are you referring to? I used git send-email for the systemd patch, and it applies just fine for me on OE-core master (using patch -p1).

Wasn't you, was mine. :)

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
#10 lore raw
In reply to Martin Kelly
Quoted 3 lines · Martin Kelly

Which patch are you referring to? I used git send-email for the systemd patch, and it applies just fine for me on OE-core master (using patch -p1).

Sorry, forgot to trim recipients. Yes, it was Jan's patch.

Ross

#11 lore raw
Quoted 11 lines · Ross

On 7 June 2017 at 17:33, Martin Kelly <[email protected] <mailto:[email protected]>> wrote:

Which patch are you referring to? I used git send-email for the systemd patch, and it applies just fine for me on OE-core master (using patch -p1).

Sorry, forgot to trim recipients. Yes, it was Jan's patch.

Alright, makes sense. Do the patches look OK to you?

#12 lore raw
Quoted 2 lines · Martin Kelly

Alright, makes sense. Do the patches look OK to you?

Yes, they're both in master now.

Ross

#13 lore raw
Quoted 9 lines · Ross

On 13 June 2017 at 17:35, Martin Kelly <[email protected] <mailto:[email protected]>> wrote:

Alright, makes sense. Do the patches look OK to you?

Yes, they're both in master now.

Ah, I was checking meta-openembedded by mistake. Thanks.

#14 lore raw
Quoted 2 lines · Martin Kelly

Ah, I was checking meta-openembedded by mistake. Thanks.

The Best Known Method is to have a oe-core clone that you use for pushing stuff upstream, and then you can just rebase to see what has been merged or what hasn't yet merged and needs rebasing.

Ross

#15 lore raw
Quoted 11 lines · Ross

On 13 June 2017 at 17:46, Martin Kelly <[email protected] <mailto:[email protected]>> wrote:

Ah, I was checking meta-openembedded by mistake. Thanks.

The Best Known Method is to have a oe-core clone that you use for pushing stuff upstream, and then you can just rebase to see what has been merged or what hasn't yet merged and needs rebasing.

Yep, I normally do that, but I have a few patches in flight between OE-core and meta-oe and I had forgotten which went where :).