Kodi ignores SIGQUIT and SIGINT
#1
I'm trying to write a bash script that closes kodi when it launches an external program, but for some reason, kodi completely ignores pretty much everything except for SIGKILL. Does anyone know why this is or how to fix it?
Reply
#2
kodi-send is the command you want.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#3
Now I am home, more info for you:

The ubuntu package you want is
Code:
kodi-eventclients-xbmc-send

Once you install that you will have the kodi-send command. Here is the help screen:

Code:
nick@envy ~ $ kodi-send
kodi-send [OPTION] --action=ACTION
Example
    kodi-send --host=192.168.0.1 --port=9777 --action="Quit"
Options
    -?, --help            Will bring up this message
    --host=HOST            Choose what HOST to connect to (default=localhost)
    --port=PORT            Choose what PORT to connect to (default=9777)
    --action=ACTION            Sends an action to XBMC, this option can be added multiple times to create a macro
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#4
Thanks! I've been looking for this. Do you know why it ignores SIGINT and SIGQUIT by default though? It really doesn't make a lot of sense to me. It also just recently started ignoring those signals too, because the script I wrote was working fine just a few days ago
Reply
#5
It's not implemented, that's why. There are some patches by stefansareav in OE and in LibreELEC that use these for SIGTERM and gracefully exit: https://github.com/OpenELEC/OpenELEC.tv/...TERM.patch
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#6
But my question is why was it working a few days ago and now it's not? Also, I tried out kodi-send and kodi just seems to be ignoring messages from that too
Reply
#7
So in the interest of other people finding this helpful, I found that kodi ignores SIGQUIT and SIGINT when I use the "wait" command in my script to wait for kodi to finish, but it closes on SIGQUIT and SIGINT when kodi is the foreground process in my script.

Here's the script in question, if anyone is interested: https://github.com/lufinkey/kodi-openbox
It runs kodi inside of an openbox session and closes kodi when you want to launch an external app (from advanced launcher or something)
Reply
#8
as already pointed, kodi does not (and never did) catch and handle any signals.
Reply
#9
Yeah I got that. The Application.Quit command sent over JSON RPC has no effect though, so I'm not going to change it. Atleast not for now. I didn't say it handled SIGINT and SIGQUIT. I just said it closed on it.

Is SIGINT and SIGQUIT handling something you're planning on adding in the future? Or, if I submitted a pull request implementing it, do you think it would get approved?
Reply
#10
what you want is

1. kodi-send -a "Quit" (this needs "allow programs on this computer to control kodi" enabled in settings)
2. wait few seconds for kodi to cleanly exit, check if process is still runing (for example with kill -CHLD and check status), if it exists, force it quit via kill -KILL

EDIT: kodi-send -a "Quit" does not! guarantee that kodi will exit, at all. any badly written addon may block it (or delay for long time) from exiting.
Reply
#11
Like I said in the other post, kodi-send and Application.Quit over jsonrpc both have no effect
Reply
#12
last time I checked, they both worked.

EDIT: nice. kodi-send indeed does not work for me (on v17). huh Wink
Reply
#13
Then it's probably something in my environment. Either way, can you answer the question in my other post?

(2016-06-22, 18:05)lufinkey Wrote: Is SIGINT and SIGQUIT handling something you're planning on adding in the future? Or, if I submitted a pull request implementing it, do you think it would get approved?
Reply
#14
ok. Quit does not work in my environment because I removed that functionality myself (and I forgot I did), you make sure you have dbus and upower+consolekit or logind installed.

(2016-06-22, 18:17)lufinkey Wrote: Then it's probably something in my environment. Either way, can you answer the question in my other post?

(2016-06-22, 18:05)lufinkey Wrote: Is SIGINT and SIGQUIT handling something you're planning on adding in the future? Or, if I submitted a pull request implementing it, do you think it would get approved?

well, it is not a trivial thing to do (in a sane, multiplatform way). I have patched openelec to handle SIGTERM just because too many people suffered "deadlock on exit" bugs. but I never tried to PR that patch to kodi (even if I cleaned it up to make it acceptable)

I think, nobody from the team is interested atm, as it is not really a big deal to handle INT/QUIT, but if you want, please do.

side note. if you make kodi handle SIGQUIT, you should know a core dump will be generated after the app quits, that's not good for half of the kodi userbase (low powered arm boxes, with slow nand/sdcards).
Reply
#15
Why would a core dump be inevitable? Wouldn't that be something that can be handled within the SIGQUIT handler to prevent that? Also what's the issue with just sending the standard Application.Quit command on SIGQUIT? You could queue it in the main thread if it's a threading issue.
Reply

Logout Mark Read Team Forum Stats Members Help
Kodi ignores SIGQUIT and SIGINT0