Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 921708 - net-proxy/haproxy-2.9.1 lingering processes and high CPU usage when running `/etc/init.d/haproxy reload`
Summary: net-proxy/haproxy-2.9.1 lingering processes and high CPU usage when running `...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Christian Ruppert (idl0r)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-10 14:44 UTC by calimeroteknik
Modified: 2024-01-17 10:23 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description calimeroteknik 2024-01-10 14:44:05 UTC
Instead of doing its thing, `/etc/init.d/haproxy reload` creates new processes and leaves the old ones running.

Additionally, at that point, the old process starts using between 130% and 200% CPU on a system with a dual processor.

When further running `/etc/init.d/haproxy reload`, the new processes that had been created are indeed restarted, but the first process(es) that were started initially stay, still eating CPU for no apparent reason. Also, the CPU usage increases.

Reproducible: Always

Steps to Reproduce:
1. /etc/init.d/haproxy start
2. /etc/init.d/haproxy reload
Actual Results:  
High CPU usage (looks like a livelock) and extra undesired processes (more each time if nbthread=1)

Expected Results:  
Just haproxy reloading updated TLS certificates from disk

My config contains:
  user haproxy
  group haproxy

Setting `nbthread 1` in the config transforms the issue into starting new processes at each reload, instead of no more processes after the first reload, and 50% CPU usage by each of them.
Comment 1 calimeroteknik 2024-01-13 23:18:23 UTC
I noticed that the issue is not present in 2.8.5, the high CPU usage starts at the first HTTPS request.
Comment 2 calimeroteknik 2024-01-13 23:27:01 UTC
Excuse the mistake, I had meant to write:
I noticed that the issue is not present in 2.8.5, _and that_ with 2.9.1 (which is the affected version), the high CPU usage starts at the first HTTPS request.

After testing, it also appears that not using HTTPS (or not receiving any HTTPS requests on any front-end even though they may exist) completely nullifies the issue.

It could therefore be a TLS-related issue.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-14 06:01:45 UTC
Might be https://github.com/haproxy/haproxy/issues/2395?
Comment 4 calimeroteknik 2024-01-14 07:54:45 UTC
Indeed, all symptoms are consistent with that bug report.

Unless even more severe security issues exist, as far as gentoo is concerned, wouldn't it be wise to keyword 2.9.1 as (at least) testing instead of stable, given this impairs production horribly?

To justify this, I should add that after 'a while' (facing the Internet) haproxy simply stops responding at all.

I suspect that at the core of this bug is the fact that haproxy doesn't close the TLS connections, and eventually all of them are hogged up, causing haproxy to make new connections wait indefinitely and time out.
Comment 5 Larry the Git Cow gentoo-dev 2024-01-15 18:25:49 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b24167aa561016cbe3dc6e8e23e45e0a016e17e4

commit b24167aa561016cbe3dc6e8e23e45e0a016e17e4
Author:     Christian Ruppert <idl0r@gentoo.org>
AuthorDate: 2024-01-15 18:25:26 +0000
Commit:     Christian Ruppert <idl0r@gentoo.org>
CommitDate: 2024-01-15 18:25:26 +0000

    net-proxy/haproxy: Bump to 2.9.2 + Cleanup
    
    Bug: https://bugs.gentoo.org/921708
    Signed-off-by: Christian Ruppert <idl0r@gentoo.org>

 net-proxy/haproxy/Manifest                         |   5 +-
 net-proxy/haproxy/haproxy-2.4.24.ebuild            | 190 ---------------------
 net-proxy/haproxy/haproxy-2.7.10.ebuild            | 190 ---------------------
 net-proxy/haproxy/haproxy-2.9.1.ebuild             | 190 ---------------------
 ...{haproxy-2.6.15.ebuild => haproxy-2.9.2.ebuild} |   2 +-
 5 files changed, 2 insertions(+), 575 deletions(-)
Comment 6 Christian Ruppert (idl0r) gentoo-dev 2024-01-15 18:27:01 UTC
(In reply to Sam James from comment #3)
> Might be https://github.com/haproxy/haproxy/issues/2395?

Yeah, it most likely is.

I just bumped to 2.9.2. Please try again.
Comment 7 Christian Ruppert (idl0r) gentoo-dev 2024-01-15 18:29:05 UTC
(In reply to calimeroteknik from comment #4)
> Unless even more severe security issues exist, as far as gentoo is
> concerned, wouldn't it be wise to keyword 2.9.1 as (at least) testing
> instead of stable, given this impairs production horribly?

2.9.1 is not marked as stable. It never was.
Comment 8 calimeroteknik 2024-01-17 10:23:09 UTC
Indeed 2.9.2 has fixed the issue!

Sorry for the confusion, I had indeed unmasked the testing version and forgotten about it.