Stop app in sailfish 4.0 from other process

hi,
So I’m finally worked on fixing my app mem! (to get disk / memory usage), ending reworking 33% of it, still one issue before uploading to the store, not that much important just annoying.

Beside displaying disk usage it lists the current process running on the phone with memory and cpu usage, also it’s possible to stop (kill) harbour/jolla app (so process owned by nemo user).
I’m using the kill command to send SIGQUIT then SIGKILL signal. App stop as expected, but there’s still a (non responsive) graphics instance visible. How to get rid of this one too ?
I see 2 process for each app, one with the executable, one from invoker, killing both doesn’t solve the problem.

Sure that’s a minor feature, you usually stop app from the main panel, I added it because, it’s was possible, and it could be handy when an app is not responsive.

1 Like

Hmm, one or two questions here:

  1. Any specific reason you use SIGQUIT (3) as opposed to SIGTERM (15)? TERM would usually be the signal of choice, it’s more standard. Also, SIGQUIT can make the process dump core and you definitely don’t want that. (java famously just dumps core on SIGQUIT and keeps running…)

  2. Do you send the two signals immediately after one another? KILL (9) doesn’t let the process clean up and may have other unwanted consequences and should be avoided if possible. The stale windows you are seeing might be a result of that.

  3. You could also try the sequence send-SIGHUP ; sleep-5-seconds ; send SIGTERM. Many processes respond to SIGHUP and exit gracefully. SIGINT (2) would also be a candidate to check, it’s the equivalent of Ctrl-C on the terminal.

2 Likes

I’m using the SIGQUIT (-3) more like a habit ; I just tried the SIGTERM, no difference but I’ll keep this one for now.

I’m using the C method kill from signal.h, first I send the (now) SIGTERM, if this fail, for example if the app is frozen / non responsive, I send the SIGKILL to terminate the app (which is the real use of this feature).

I tried as you suggested others signals, same : app exit, it’s not present anymore ( from ps - A in ssh/console) but there’s still the graphic view on the screen, clicking on it start the app again.