Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get warning notifications #100

Open
kecsap opened this issue Jun 5, 2020 · 12 comments
Open

Unable to get warning notifications #100

kecsap opened this issue Jun 5, 2020 · 12 comments

Comments

@kecsap
Copy link

kecsap commented Jun 5, 2020

I set in nohang-desktop.conf:

warning_threshold_min_mem  = 20 %

Warnings enabled:

low_memory_warnings_enabled = True

Restarting the daemon:

sudo systemctl restart nohang-desktop

Pushing the system below this threshold:

2020-06-05 20:28:26,663: Monitoring has started!
2020-06-05 20:28:26,663: MemAvail:  3792 M, 24.8 % | SwapFree: 17093 M,  89.6 % | dMem:     0 M/s
2020-06-05 20:28:38,672: MemAvail:  3784 M, 24.7 % | SwapFree: 17093 M,  89.6 % | dMem:    -1 M/s
2020-06-05 20:28:50,680: MemAvail:  3324 M, 21.7 % | SwapFree: 17093 M,  89.6 % | dMem:   -38 M/s
2020-06-05 20:29:02,691: MemAvail:  2977 M, 19.4 % | SwapFree: 17093 M,  89.6 % | dMem:   -29 M/s
2020-06-05 20:29:14,697: MemAvail:  3013 M, 19.7 % | SwapFree: 17093 M,  89.6 % | dMem:     3 M/s
2020-06-05 20:29:26,706: MemAvail:  3019 M, 19.7 % | SwapFree: 17093 M,  89.6 % | dMem:     0 M/s
2020-06-05 20:29:38,716: MemAvail:  3660 M, 23.9 % | SwapFree: 17093 M,  89.6 % | dMem:    53 M/s
2020-06-05 20:29:50,726: MemAvail:  3710 M, 24.2 % | SwapFree: 17093 M,  89.6 % | dMem:     4 M/s
2020-06-05 20:30:02,733: MemAvail:  3727 M, 24.3 % | SwapFree: 17093 M,  89.6 % | dMem:     1 M/s
2020-06-05 20:30:14,744: MemAvail:  3781 M, 24.7 % | SwapFree: 17093 M,  89.6 % | dMem:     5 M/s
2020-06-05 20:30:26,753: MemAvail:  3769 M, 24.6 % | SwapFree: 17093 M,  89.6 % | dMem:    -1 M/s

...and nothing happens. No desktop notification or indication in the log. I tried to set warning_exe in the config, but it does not change anything.

@hakavlad
Copy link
Owner

hakavlad commented Jun 5, 2020

SwapFree: 17093 M, 89.6 %

This is the problem.

Warnings happens if both MemAvailable and SwapFree thresholds are exceeded.

@hakavlad
Copy link
Owner

hakavlad commented Jun 5, 2020

If you set warning_threshold_min_swap = 100 %
notifications will be shown if MemAvailable < 20%.

@kecsap
Copy link
Author

kecsap commented Jun 5, 2020

Now it works. This is a really yummy software if you get it working. I hate that I chosen a laptop with 16 GB RAM to avoid running out of RAM and I can still freeze the machine with ease. Kernel OOM is a joke, it is not worth anything for an average user.

I am not against software with minimal documentation, but there were two things why I bang my head to the wall after some time:

  1. It is not intuitive at all to have white spaces as comment sign in the config file while you also use hashmark like "comments" above the commented lines. -> This is important since I did not understand why my custom rules for additional badness adjustment (after white spaces) did not work and I only scratched my head and get frustrated over time.

  2. Without reading the source code, no way to find out this condition:

"If you set warning_threshold_min_swap = 100 %
notifications will be shown if MemAvailable < 20%."

You should add some additional comment to the config file to highlight the logic between these conditions since it is quite black box now.

Otherwise you can close this issue.

@kecsap
Copy link
Author

kecsap commented Jun 5, 2020

An additional comment. I don't know how much my use case is unique, but I prefer to kill sacrificable applications (e.g. code editors, chrome instances) on time to avoid any longer freezing. The swap level does not mean too much in my case because the normal RAM gets full suddenly and I don't want to wait for 10-60 minutes to get back my computer. I follow the RAM usage on my panel in KDE, but I still can get unwanted freezes time-to-time. So it can be a quite common use case when people want early intervention with this daemon and having the killing decisions based on purely the actual remaining RAM. Now I have these min_swap options raised to 100 % for all warning/soft/hard thresholds and it works nicely. The RAM trigger levels are 20-15-10 %. Maybe that is the problem of the user in #98, the expectations were earlier kickin.

@hakavlad
Copy link
Owner

hakavlad commented Jun 5, 2020

Thanks for the feedback!

I know the documentation is terrible.
https://github.com/hakavlad/nohang#known-problems
The problem is being solved slowly: #22
Right now I'm working on improving the documentation, then there will be a release.

I did not understand why my custom rules for additional badness adjustment (after white spaces) did not work

This is described in the second line of the config:

    This is nohang config file.
    Lines starting with #, tabs and spaces are comments.
    Lines starting with @ contain optional parameters.
    All values are case sensitive.

Is this not enough?

@kecsap
Copy link
Author

kecsap commented Jun 5, 2020

This is described in the second line of the config:

    This is nohang config file.
    Lines starting with #, tabs and spaces are comments.
    Lines starting with @ contain optional parameters.
    All values are case sensitive.

Is this not enough?

It is enough, but 9x % of the users will not read it, including me. When the config file is opened, the numbered list of options is eye-catching and the attention quickly shifts to the individual options inside the file to crunch them. The first lines are missed.

I am not aware of any Linux daemon which uses white space as comment in the config file inside /etc, but I remember config files with white spaces before the options and they are omitted. Average Linux user speaks from inside, I expect what is the de-facto standard for config files on Linux. If you want to stick to your custom format, put some "WARNING !!!" before and after the explanation in the header to catch the attention.

@hakavlad
Copy link
Owner

hakavlad commented Jun 5, 2020

put some "WARNING !!!

e6f5363 Done.

@hakavlad
Copy link
Owner

hakavlad commented Jun 5, 2020

I don't want to wait for 10-60 minutes to get back my computer

PSI can help you. It can allow you to use swap space if swapping is not too aggressive, but the offender will be terminated if swapping will be to aggressive and prolonged (aggressiveness and duration can be adjusted).

Of course, the settings you use with the prohibition of swapping are much more aggressive.

PSI can help you to suppress only pathological swapping, and let you to use swapping if it is not pathological.

@kecsap
Copy link
Author

kecsap commented Jun 5, 2020

I will use PSI once I switch to Ubuntu 20.04 later.

If you add something additional info about the trigger logic to the "4. Warnings and notifications", this issue can be closed.

@ElijahLynn
Copy link
Contributor

ElijahLynn commented Feb 19, 2022

If you set warning_threshold_min_swap = 100 % notifications will be shown if MemAvailable < 20%.

Thanks, I had installed nohang a while ago and tried getting notifications working and read through the readme a few times too but gave up, and only many months later, today, did I give it another try.

I edited /etc/nohang/nohang-desktop.conf and set warning_threshold_min_swap = 25 % to warning_threshold_min_swap = 100 % then did a systemctl restart nohang-desktop then went through my browser history (ctrl + h) and started ctrl clicking links like crazy, monitored memory with watch "free --human" until the memory dropped below 20% (warning_threshold_min_mem) and POW, I got notifications now!!!!

I think it would be good to put this as a troubleshooting step in the notifications section on the README, I can make a PR if you like.

So thank you for this tip!! If you throw a Sponsor link up on the repo I'd be happy to throw in some cash, this project has saved me real time in my life and I really appreciate it!

@alexmyczko
Copy link

The warning system only works with local users right? What about a warning system using wall for remote systems and all users? Otherwise admins have to enable users to be able read dmesg output, and user actively check the output...

@hakavlad
Copy link
Owner

hakavlad commented Apr 1, 2023

@alexmyczko See post_kill_exe = config option.

post_kill_exe = wall haha nohang goes brrr

However, this only works for hard threshold.

For soft threshold:

# Note that a command is slower than sending a signal.
# Empty regex matches with any name.
@SOFT_ACTION_RE_NAME    /// sh -c "kill -TERM  $PID & wall haha nohang goes brrr"

This command will be executed instead of sending SIGTERM.
It might work, you can try. (I didn't check it with wall)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants