public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Shannon Sterz" <s.sterz@proxmox.com>
To: "Jordyn Hamilton" <j.hamilton@proxmox.com>,
	<pve-devel@lists.proxmox.com>
Cc: c.hughes@proxmox.com
Subject: Re: [PATCH common 2/2] Added logic to check for d state to run subroutine
Date: Thu, 19 Nov 2026 16:33:52 +0100	[thread overview]
Message-ID: <DMZAPCSDF048.37AMU4PNIHY2M@proxmox.com> (raw)
In-Reply-To: <20261119145011.8017-3-j.hamilton@proxmox.com>

this patch doesn't apply any longer

On Thu Nov 19, 2026 at 3:50 PM CET, Jordyn Hamilton wrote:
> Within the timeout error logic branch, I added flow to check for a D
> state and customize the error message to reflect that state. I chose the
> timeout branch as the d state check would only be required if the
> process takes long enough to time out.
>
> Logic tree queues a `SIGKILL` prior to any D state checking, as the
> system would queue the signal if the process is in a D state, meaning it
> would auto terminate once the state resolves. This also means the
> standard timeout error checking remains untouched, it still sends the
> signal, waits for the process to terminate then dies.
>
> Since there is no way to terminate D state processes programatically,
> the program only overwrites the error message then terminates. It
> directs the user in the right direction for debugging and provides all
> the information necessary for beginning that process including the
> `$pid` and `$cmd_str`.
>
> Modified the d state error message to include that the process can only
> be terminated by resolving the errors or performing a system reboot.
>
> Signed-off-by: Jordyn Hamilton <j.hamilton@proxmox.com>
> ---
>  src/PVE/Cmd.pm | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/Cmd.pm b/src/PVE/Cmd.pm
> index 773e55a..20cd62b 100644
> --- a/src/PVE/Cmd.pm
> +++ b/src/PVE/Cmd.pm
> @@ -53,7 +53,7 @@ sub in_d_state($pid) {
>      # extracting the stat character from the input
>      my $status = $1 if $stat_in =~ /^\d+\s+\(.*\)\s+([A-Z])/;
>
> -    return ($status eq 'D');
> +    return $status eq 'D';

please refrain from modifying could trivial here. this line is added in
the previous commit, so this change should have just been part of that
patch. otherwise, this creates more review overhead. thank you!

>  }
>
>  # The $cmd parameter can be:
> @@ -326,7 +326,17 @@ sub run($cmd, %param) {
>      if ($err) {
>          if ($pid && ($err eq "got timeout\n")) {
>              kill(9, $pid);
> -            waitpid($pid, 0);
> +            if (in_d_state($pid)) {
> +                $err = "process '$pid' is in an uninterruptible sleep " .
> +                    "and cannot resolve or be terminated by this program.\n" .
> +                    "This process can only be terminated by resolving the errors " .
> +                    "or performing a system reboot.\n" .
> +                    "This is due to underlying kernel or hardware errors, " .
> +                    "check dmesg for errors or " .
> +                    "kernel messages.\n";

nit: this string isn't wrapped according to our style guide [1].

[1]: https://pve.proxmox.com/wiki/Perl_Style_Guide#Wrapping_Strings

> +            }else {
> +                waitpid($pid, 0);
> +            }
>              die "command '$cmdstr' failed: $err";
>          }
>





  reply	other threads:[~2026-11-19 15:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 14:50 [PATCH common 0/2] Adding D state checking to the run command Jordyn Hamilton
2026-11-19 14:50 ` [PATCH common 1/2] Added subroutine to check process status Jordyn Hamilton
2026-11-19 15:33   ` Shannon Sterz
2026-11-19 14:50 ` [PATCH common 2/2] Added logic to check for d state to run subroutine Jordyn Hamilton
2026-11-19 15:33   ` Shannon Sterz [this message]
2026-11-19 15:33 ` [PATCH common 0/2] Adding D state checking to the run command Shannon Sterz
2026-11-19 18:49 ` superseded " Jordyn Hamilton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DMZAPCSDF048.37AMU4PNIHY2M@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=c.hughes@proxmox.com \
    --cc=j.hamilton@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal