Hi Pieter, Could you test the attached patch ? It seems to fix the problem, but I have some doubts about the reliability of the patch.
Thierry On Fri, 11 May 2018 20:13:25 +0200 PiBa-NL <[email protected]> wrote: > Hi Thierry, > > Okay found a simple reproduction with tcploop with a 6 second delay in > there and a short sleep before calling kqueue. > > ./tcploop 81 L W N20 A R S:"response1\r\n" R P6000 S:"response2\r\n" R [ > F K ] > > gettimeofday(&before_poll, NULL); > + usleep(100); > status = kevent(kqueue_fd[tid], // int kq > > Together with the attached config the issue is reproduced every time the > /myapplet url is requested. > > Output as below: > 00000000:stats.clihdr[0007:ffffffff]: Accept-Language: > nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7 > [info] 130/195936 (76770) : Wait for it.. > [info] 130/195937 (76770) : Wait response 2.. > xref_get_peer_and_lock xref->peer == 1 > > Hope this helps to come up with a solution.. > > Thanks in advance, > PiBa-NL (Pieter) > > Op 9-5-2018 om 19:47 schreef PiBa-NL: > > Hi Thierry, > > > > Op 9-5-2018 om 18:30 schreef Thierry Fournier: > >> It seems a dead lock, but you observe a loop. > > Effectively it is a deadlock, it keeps looping over these few lines of > > code below from xref.h > > <http://git.haproxy.org/?p=haproxy.git;a=blob_plain;f=include/common/xref.h;hb=29d698040d6bb56b29c036aeba05f0d52d8ce94b>.. > > > > The XCHG just swaps the 2 values (both are '1') and continues on, then > > the local==BUSY check is true it loops and swaps 1 and 1 again, and > > the circle continues.. > > > > Thanks for looking into it :) Ill try and get 'simpler' reproduction > > with some well placed sleep() as you suggest. > > Regards, > > PiBa-NL > > > > http://git.haproxy.org/?p=haproxy.git;a=blob;f=include/common/xref.h;h=6dfa7b62758dfaebe12d25f66aaa858dc873a060;hb=29d698040d6bb56b29c036aeba05f0d52d8ce94b > > > > >
>From ea4ad78120759351f203797ca263b8247edd88a5 Mon Sep 17 00:00:00 2001 From: Thierry FOURNIER <[email protected]> Date: Fri, 18 May 2018 16:22:20 +0200 Subject: [PATCH 1/2] BUG/MEDIUM: lua: Dead-lock with socket In some cases, ... fill later --- src/hlua.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/hlua.c b/src/hlua.c index 8cc305138..15a5397e1 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -1781,7 +1781,6 @@ __LJMP static int hlua_socket_receive_yield(struct lua_State *L, int status, lua co_skip(oc, len + skip_at_end); /* Don't wait anything. */ - stream_int_notify(&s->si[0]); stream_int_update_applet(&s->si[0]); /* If the pattern reclaim to read all the data @@ -2004,7 +2003,6 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext } /* update buffers. */ - stream_int_notify(&s->si[0]); stream_int_update_applet(&s->si[0]); s->req.rex = TICK_ETERNITY; -- 2.16.3

