Hello Alexander,

On Mon, Jan 26, 2026 at 04:16:56PM +0000, Stephan, Alexander wrote:
> Subject: RE: BUG/MINOR: mworker/cli: avoid duplicates in 'show proc'
> Hi William,
> 
> I have been investigating the backport situation a bit and I wanted to 
> quickly share some findings that might be useful.
> 

I backported the patches to version 3.2, but as you already observed, there's a 
lot of changes before this version. The
"program" section still exists in these versions and the code was not written 
for it.

I backported a few patches to do the backport as far as 3.0 but I don't think 
it's worth it going further given the
impact of the problem. We probably don't want to mess with a feature which 
works for 99% of usecases in an older branch.

> So, I noticed a difference regarding the process list before version 3.0, 
> which would need to be accounted for.
> "show proc" still uses the default parser here, which leaves appctx->svcctx 
> uninitialized: 
> https://github.com/haproxy/haproxy/blob/f76e73511addd075f556449b0ebf33c9f7a5184b/src/mworker.c#L803C100-L803C117
> Therefore, additional context would be needed like in the patch below where 
> also the custom parser method needs to be copied from master.
> 
> Furthermore, from what I can see the process list works a bit differently 
> when it comes to reloads, using a min counter: 
> https://github.com/haproxy/haproxy/blob/f76e73511addd075f556449b0ebf33c9f7a5184b/src/mworker.c#L174
> With the 1:1 logic from master, I again run into duplicates and messed up 
> ordering in the the "show proc" output.
> 
> I had success fixing this by adjusting the iteration, replacing 
> ctx->next_reload = child->reloads with ctx->next_reload = child->reloads + 1; 
> and replace
> 
> if (ctx->next_reload && child->reloads >= ctx->next_reload)
>       continue;
> with
> 
> if (ctx->next_reload && child->reloads < ctx->next_reload)
>       continue;
> 
> in the old worker part. I appended the resulting patch which directly applies 
> to 3.0-dev13 (just as an example, not fully ready for a commit yet).
> 
> With this, it works very well for me for the backport targets 2.8 and 3.0 
> (deferred from the issue https://github.com/haproxy/haproxy/issues/3204).
> 
> I hope this helps, I am also curious whether you agree with my approach here.
> 
> Thanks in advance, and best regards,

Thank you for the investigating the problem. Regarding your patch, we try to 
backport the patches instead of writing new
ones in previous branches. So for the 3.0 branch I backported these ones:

e41829dda6 BUG/MINOR: mworker/cli: fix show proc pagination using reload counter
9cae4b8f28 BUG/MINOR: mworker/cli: 'show proc' is limited by buffer size
48d20c79e7 MINOR: mworker/cli: 'show proc debug' for old workers
5b851f94af MINOR: mworker/cli: remove comment line for program when useless
948a4c372b MINOR: mworker/cli: add 'debug' to 'show proc'
d55d3c6225 CLEANUP: mworker/cli: remove useless variable

These are minor changes that are not that intrusive for a backport, backporting 
without them would change too much the
original patches, so I took them in 3.0.

Regards,

-- 
William Lallemand


Reply via email to