hishamhm / htop

htop is an interactive text-mode process viewer for Unix systems. It aims to be a better 'top'.
GNU General Public License v2.0
5.84k stars 581 forks source link

Refresh process name issue, new name retains characters from the previous name #905

Open cherio opened 5 years ago

cherio commented 5 years ago

Hisham,

It looks like htop doesn't always properly update process names when the corresponding option is enabled (as suggested in #672). Specifically I observe this happening with postgresql processes. To me it feels like it refreshes the name but the remainder of that line retains what it displayed previously.

Take a look at the screenshot I attached. htop-refresh-names

Notice that some postgres processes end with "idle" but others end with "idle in transaction" or "idleCT". Those that display "idleCT" previously displayed "SELECT" and after the name changes it refreshes the 1st 4 characters but retains "CT" after "idle". Same applies to those that end with "idle in transaction". When the name changes to end with "idle" the remainder "in transaction" isn't cleared. Similar symptoms (not on the screenshot) are when a postgres process name that ends with "UPDATE" or "INSERT" turns to a name that ends with "idleTE" or "idleRT" respectively. I am sure you see the picture.

Environment:

$ uname -a
Linux HOSTNAME 4.15.0-46-generic # 49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ htop --version
htop 2.1.0 - (C) 2004-2018 Hisham Muhammad

$ cat /etc/os-release | grep VERSION=
VERSION="18.04.2 LTS (Bionic Beaver)"

Let me know if you need more info. Thanks!!!

creoev commented 5 years ago

Indeed, if you run the script:

#!/usr/bin/perl
use 5.016;

my $name = 'process name string';
while ($name) {
    $0 = $name;
    say $name;
    $name = $name =~ s/^.//r;
    sleep 1;
}

In the htop see the process name: "ggggggngggggggggngg"

Komzpa commented 5 years ago

I am also affected by this issue.

CREATE INDEX AS here is "CREATE TABLE AS" that was replaced by "CREATE INDEX". image

14mRh4X0r commented 5 years ago

This has already been fixed in #812.