Stop killing process if it stops responding

There is a program that every now and then says whether I want to close it or wait because it’s not responding, if I click wait it works fine. Sometimes I miss the message and it closes soon after. How do I avoid the system killing this program?

The program was finished after delay - which is why you where asked whether you want to wait or close it.
… you missed to react to the message - it d´finished in the meantime - and the message was then superfluous and disappeared …

2 Likes

I don’t see how this is relevant. I want the program to stop closing without having to be clicking on a button all the time. So I don’t care about the message.

you would need to look into why the app is triggering the system to throw the error.
for some reason, it is not responding to system checks while processing. You want that check and you want the system to throw that error so the best way is to get the app fixed :slight_smile:

So I misunderstood what you said
… or you described the issue poorly, allowing me to misunderstand you and answering to something that you did not ask :wink:

I may want the system to throw an error but I most certainly don’t want it closing my programs if I take too long clicking the wait button. And when I click wait the program works just fine, so I don’t want anything to change for the program. It’s the system that’s at fault here, I just need to change it to make sure it doesn’t close the program even if it stops responding. And if a program stops responding I’ll close it myself, thank you very much.

Which program?


I’d say it’s the window manager at work, though i haven’t seeing that behavior on Linux since long ago.
Which window manager do you use?

It’s happened with many programs. Usually the ones that take long to load, for example firefox when I open a page too long and it takes a while to open.

❯ wmctrl -m
Name: Mutter
Class: N/A
PID: N/A
Window manager's "showing the desktop" mode: OFF

This seems relevant:
https://unix.stackexchange.com/questions/585075/this-application-is-not-responding-nonsense-with-x11-forwarding


gnome "application is not responding" at DuckDuckGo

1 Like

gsettings set org.gnome.mutter check-alive-timeout 0
or
dconf write /org/gnome/mutter/check-alive-timeout 0

I still see the same dialog after setting this configuration.

I’m using cinnamon.

Hi, I think you could rely on nohang (github). It’s in the aur.

Besides that, check the status of systemd-oomd. You can disable it and see if it helps.

systemctl status systemd-oomd

Another suggestion, ananicy-cpp is a clever tool (aur) for those type of errors. Also, grab the package with rules (aur) suggested by its user base.

In addition, you can use a zombie script that would bring back an app once killed by the system. Just be cautious when you use it, as the only way to terminate the app will be by logging off or rebooting. But if you’ve run it through terminal, just close it and the app won’t reload.

nano ~/.local/bin/zombie.sh

Insert these lines:

#!/bin/bash

if [[ -z "$1" ]];then
    echo "ERROR: must specify program"
    exit 1
fi

while (( 0 == 0 ));do
    $@ &
    pid=`jobs -l | awk '{print $2}'`
    wait $pid
done

Mark it executable:

chmod +x ~/.local/bin/zombie.sh

I am assuming here that ~/.local/bin/ is already in your path. Then you can call zombie.sh followed by the app you want to make immortal for the current session.

zombie.sh firefox-developer-edition

I’d like to question the whole assumption (or what it is that I could glean from what was posted here):

that a process is killed when not reacting timely to a message that essentially says:
“It’s taking long - do you want to still wait or close it instead”
and that closing it is the default
even when not reacting to it - not choosing any one of the two options

I simply do not think that that is the case.
The default is (or should be) waiting …

If it is still “closing” the delayed app, even though it should not …

perhaps add swap (if you don’t have any - while you should …)

I really don’t think it is forcefully closing/killing the application. Could it be the app is crashing and therefore being killed? A browser loading a page, leading to this dialog does sound more like an application crash, i.e. due to low memory, damaged RAM etc.

… that is part of what I meant :ok_hand:

Hey, are this for killing a process to avoid hanging the system? I want to keep the process alive. I haven’t had any issue with the system hanging.

systemd-oomd is disabled.

When I fail to react in time to the message “Process not responding quit or wait” it quits by default, I want it to wait by default.

I’ve got 16.1 GB of memory and 17.7 GB of swap. With around 85% and 60% usage right now. I should take a look at it when the program closes but its not like it warns me when it closes, since it’s in the back-ground and it doesn’t even show in the front-ground for me to see the message.

Should I open many programs until I run out of RAM to see if it closes then?

that seems to be in odds with the premise of this thread

also:

specificity is lacking

I don’t know.
But replication (others can observe the same) is kind of crucial.

See this as a way to optimise your memory and CPU usage. May sound counterproductive to use nohang, but paired with ananicty-cpp you have a smooth system. The idea behind my suggestion is that there is a possibility that an app in the foreground is being killed, either because it is misbehaving or because there’s something else in the background taking a load in your system.