Hi List,

It have a bug with internal applets. Maybe this bug impacts other parts
like these subject "Connections stuck in CLOSE_WAIT state with h2".

when the applet requires more data and doesn't read the input buffer
buffer, and when the client stops waiting and break the connection, a
CLOSE-WAIT state appears and never disappear.
 
I propose a simple applet to reproduce the bug. I join the C
code. To build haproxy with this code, just edit Makefile and add

   OPTIONS_OBJS += bug39.o

near the line 445.



The conf juste use the applet. The bug works with http and tcp.

Start haproxy like this:

   ./haproxy -d -f bug39.1.conf

   or

   ./haproxy -d -f bug39.2.conf

And curl like this (for http an tcp cases):

   curl --max-time 1 http://127.0.0.1:8080/


Thierry
#include <types/action.h>

#include <proto/applet.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>

static void bug39_http_fct(struct appctx *ctx)
{
	struct stream_interface *si = ctx->owner;
	fprintf(stderr, "%s\n", __FUNCTION__);

	if (si->state == SI_ST_DIS || si->state == SI_ST_CLO)
		return;

	/* alway wait data, and never read data from input. */
	si_applet_cant_get(si);
}

static void bug39_http_release(struct appctx *ctx)
{
	fprintf(stderr, "%s\n", __FUNCTION__);
}

static int bug39_http_init(struct appctx *ctx, struct proxy *px,
                           struct stream *strm)
{
	fprintf(stderr, "%s\n", __FUNCTION__);
	return 1;
}

static enum act_parse_ret bug39_parse(const char **args, int *cur_arg,
                                      struct proxy *px,
                                      struct act_rule *rule, char **err)
{
	rule->applet.obj_type = OBJ_TYPE_APPLET;
	rule->applet.name     = "<bug39>";
	rule->applet.init     = bug39_http_init;
	rule->applet.fct      = bug39_http_fct;
	rule->applet.release  = bug39_http_release;
	rule->applet.timeout  = 10000;
	return ACT_RET_PRS_OK;
}

static struct action_kw_list bug39_akl = { { }, {
	{ "bug39", bug39_parse },
	{ /* end */ }
}};

__attribute__((constructor))
static void __bug39_init(void)
{
	fprintf(stderr, "%s\n", __FUNCTION__);
	service_keywords_register(&bug39_akl);
}

Attachment: bug39.1.conf
Description: Binary data

Attachment: bug39.2.conf
Description: Binary data

Reply via email to