GithubHelp home page GithubHelp logo

Comments (5)

capflam avatar capflam commented on June 2, 2024 1

Pushed ! It should be fixed now. Thanks !

from haproxy.

felipewd avatar felipewd commented on June 2, 2024

To make things easy to reproduce, we can load the map referencing the config-file, reload haproxy and try and clear the map right after a usual reload.

No need to use add map to reproduce the issue

from haproxy.

Darlelet avatar Darlelet commented on June 2, 2024

Thanks for the report @felipewd!

static int cli_io_handler_clear_map(struct appctx *appctx)
{
        struct show_map_ctx *ctx = appctx->svcctx;
        int finished;

        HA_RWLOCK_WRLOCK(PATREF_LOCK, &ctx->ref->lock);
        finished = pat_ref_purge_range(ctx->ref, ctx->curr_gen, ctx->prev_gen, 100);
        HA_RWLOCK_WRUNLOCK(PATREF_LOCK, &ctx->ref->lock);

        if (!finished) {
                /* let's come back later */
                applet_have_more_data(appctx);

map pruning is segmented through batches of 100 entries each to prevent the process from monopolizing a CPU core which would cause contention otherwise. If entries still remain after a pruning batch, the applet is re-scheduled to continue where it left off.

As you pointed out this used to work properly in the past, but since f37ddbe ("MAJOR: cli: Update the CLI applet to handle its own buffers") it looks like the applet is not woken back properly and because of that it doesn't get the chance to finish the pruning process, and only a few hundreds items maximum are removed. When this happens, we can also notice that the cli command hangs instead of returning promptly.

from haproxy.

capflam avatar capflam commented on June 2, 2024

Indeed. Thanks @Darlelet ! The issue is in sc_applet_recv(). SE_FL_HAVE_NO_DATA flag is updated in the same way than for muxes while it is in fact the applet responsibility to do so. I will push a commit soon. But in the mean time the following should fix the issue:

diff --git a/src/stconn.c b/src/stconn.c
index 930b92b1bd..621d51e429 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -2094,9 +2094,7 @@ int sc_applet_recv(struct stconn *sc)
        }
 
  done_recv:
-       if (!cur_read)
-               se_have_no_more_data(sc->sedesc);
-       else {
+       if (cur_read) {
                channel_check_xfer(ic, cur_read);
                sc_ep_report_read_activity(sc);
        }
@@ -2125,12 +2123,7 @@ int sc_applet_recv(struct stconn *sc)
                sc->flags |= SC_FL_ERROR;
                ret = 1;
        }
-       else if (!cur_read &&
-                !(sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM)) &&
-                !(sc->flags & (SC_FL_EOS|SC_FL_ABRT_DONE))) {
-               se_have_no_more_data(sc->sedesc);
-       }
-       else {
+       else if (cur_read || (sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))) {
                se_have_more_data(sc->sedesc);
                ret = 1;
        }

from haproxy.

felipewd avatar felipewd commented on June 2, 2024

hey @capflam I can confirm this patches fixes the issue, thanks!

from haproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.