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

Screen frequently flickers when outputting to local display #2490

Closed
ATLief opened this issue Jul 7, 2023 · 13 comments
Closed

Screen frequently flickers when outputting to local display #2490

ATLief opened this issue Jul 7, 2023 · 13 comments

Comments

@ATLief
Copy link

ATLief commented Jul 7, 2023

Describe the bug
When outputting to a local display, sections of the screen frequently flicker as the information updates. Reverting commit ed4cc5e fixes this particular issue, but re-introduces the bug in #2211. Increasing the delay between updates increases the delay between flickers. This issue doesn't happen when displaying the console on another computer over SSH.

To Reproduce

  1. Plug a display (HDMI and VGA tested) directly into the computer
  2. Start a console session on that display (native Linux fbcon and kmscon tested)
  3. Start a glances session in that console session (standalone and client mode tested)
  4. See error

Expected behavior
The text on the screen changes without large portions of the text briefly disappearing.

Screenshots

Med_VS.mov

Environement

  • Operating System: Debian GNU/Linux 12 (bookworm)
  • Glances & psutil versions: Glances v3.3.1.1 with PsUtil v5.9.4
  • How do you install Glances: Package manager (Apt)
  • Glances test:
===============================================================================
Glances 3.3.1.1 (/usr/lib/python3/dist-packages/glances/__init__.py)
Python 3.11.2 (/usr/bin/python3)
PsUtil 5.9.4 (/usr/lib/python3/dist-packages/psutil/__init__.py)
===============================================================================
alert         [OK]    0.00001s []
amps          [OK]    0.00126s key=name [{'key': 'name', 'name': 'Dro
cloud         [OK]    0.00001s {}
connections   [NA]
core          [OK]    0.00058s {'phys': 6, 'log': 12}
cpu           [NA]
diskio        [OK]    0.00105s key=disk_name [{'time_since_update': 2
docker        [OK]    0.00002s []
folders       [OK]    0.00001s []
fs            [OK]    0.00042s key=mnt_point [{'device_name': '/dev/m
gpu           [OK]    0.00001s []
help          [OK]    0.00000s None
ip            [OK]    0.00056s {'gateway': '192.168.6.1', 'address': 
irq           [NA]
load          [NA]
mem           [OK]    0.00008s {'total': 16684060672, 'available': 11
memswap       [OK]    0.00009s {'total': 8589930496, 'used': 66322432
network       [OK]    0.00046s key=interface_name [{'interface_name':
now           [OK]    0.00001s 2023-07-06 18:46:13 EDT
percpu        [OK]    0.00004s key=cpu_number [{'key': 'cpu_number', 
ports         [OK]    0.00000s [{'host': '192.168.6.1', 'port': 0, 'd
processcount  [OK]    0.17216s {'total': 1581, 'running': 1, 'sleepin
processlist   [OK]    0.00056s key=pid [{'memory_info': pmem(rss=5190
psutilversion [OK]    0.00001s (5, 9, 4)
quicklook     [OK]    0.00018s {'cpu': 7.5, 'percpu': [{'key': 'cpu_n
raid          [NA]
sensors       [OK]    0.00000s key=label [{'label': 'Composite', 'uni
smart         [NA]
system        [OK]    0.00000s {'os_name': 'Linux', 'hostname': 'post
uptime        [OK]    0.00006s {'seconds': 11296}
wifi          [NA]
===============================================================================
Total time to update all stats: 0.18445s
===============================================================================

Additional context
Please ignore the empty space on the right side of the display; I limit the number of TTY columns to hide the VIRT and RES columns in Glances, but the problem persists even without that limitation.

If this issue can't be fixed, maybe you could add an option to use the new or old clearing behaviour, or an option to clear the screen at a slower interval (maybe every 30 update intervals, or every minute).

Thank you for fixing the other bug, and everything else you do for this awesome project!

@nicolargo
Copy link
Owner

Thanks for the issue report (and the video).

I did not reproduce on my side. Can you please try with the latest Glances version (3.4.0.2) ?

@ATLief
Copy link
Author

ATLief commented Jul 9, 2023

@nicolargo I installed 3.4.0.2 via PyPi/pipx (Glances v3.4.0.2 with PsUtil v5.9.5) and was able to reproduce the issue. There was also a version 3.4.0.3 on PyPi (Glances v3.4.0.3 with PsUtil v5.9.5) that I tried and it had the same issue.

But I found something else: I could reproduce the issue on another computer (running the same version of Debian), but not within an X session (even when maximizing the window). So maybe it has something to do with window management / the terminal emulator.

@nicolargo
Copy link
Owner

Issue should be solved in the development branch. I switch back to self.term_window.erase() and add a new hot key (Ctrl-R) to force a self.term_window.clear() (related to #2211).

@nicolargo nicolargo added this to the Glances 4.0.0 milestone Jul 15, 2023
@ATLief
Copy link
Author

ATLief commented Jul 22, 2023

Thanks! Would you be willing to accept a PR in a few weeks that periodically calls self.term_window.clear()? Maybe as a hard-coded proportion of the updates? I'm thinking every 150 updates, which would be every 5 minutes at 2 seconds between updates. I can also try to add a config option and cli argument to change that multiple.

For anyone else experiencing #2211 again, a hacky workaround is to periodically echo control-r into the stdin of glances. For example while sleep 300; do echo -n $'\cr'; done | glances, although this prevents other interactive input. There's probably a better workaround when run directly on a TTY.

@nicolargo
Copy link
Owner

@ATLief yes a PR with a configurable self.term_window.clear() call every n seconds can make sense (by default n should be unset or set to 0 to avoid call to self.term_window.clear().

@FichteFoll
Copy link

FichteFoll commented Oct 12, 2023

For the record, I also experience this on Arch with alacritty. On every refresh, the entire terminal window very briefly flickers, most likely by being empty for a fraction of a second/one frame. When the window is very small, it becomes less noticable or not at all, presumably because refilling the few characters of the window happens fast enough that a display refresh doesn't happen between clearing the window and refilling it.

Other tools like htop do not have this issue and I also haven't seen #2580 with them, but I also very rarely have other processes running in the background of the same shell I later run a TUI in, if ever, so the potential for this happening is much reduced.
Would using the "alternate screen" feature of terminal emulators be an option?

@rubin110
Copy link

rubin110 commented Dec 21, 2023

I'm seeing this issue with Windows Terminal 1.18.3181.0 under Debian Bookworm via WSL, Glances 3.3.1.1 deb from the Debian repos, when connecting to a different machine on my network. SSHing into that machine and running glances -c there I don't have the flicker issue, nor do I when running glances locally within WSL or running the server locally and connecting locally.

@johananl
Copy link

For the record, I also experience this on Arch with alacritty.

I confirm this is happening for me, too, with alacritty 0.14.0-dev (cb3a79db).

@x61s
Copy link

x61s commented May 22, 2024

The same. Blinking every second.

Glances v3.3.1.1 with PsUtil v5.9.4
alacritty 0.11.0
Debian 12.5

@nicolargo
Copy link
Owner

nicolargo commented May 22, 2024

Should be solved in Glances 4.0.0.

@FichteFoll
Copy link

Can confirm, thanks for the fix!

@ATLief
Copy link
Author

ATLief commented May 29, 2024

@nicolargo Thanks again for fixing this! Since it unfortunately re-introduces #2211, would you mind re-opening that issue to help with future search-ability?

@nicolargo
Copy link
Owner

Is it reintroduce in version 4.0.7 ?

Can you also try with another terminal ?

@nicolargo nicolargo modified the milestones: Glances 4.1.0, Glances 4.0.8 Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants