]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: lua/socket: wrong scheduling for sockets
authorThierry FOURNIER <thierry.fournier@ozon.io>
Fri, 25 May 2018 12:38:57 +0000 (14:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 31 May 2018 08:58:41 +0000 (10:58 +0200)
The appctx pointer is given from any variable which are wrong.
This implies the wakeup of wrong applet, and the socket are no
longer responsive.

This behavior is hidden by another inherited error which is
fixed in the next patch.

This patch remove all wrong appctx affectations.

This patch must be backported in 1.6, 1.7 and 1.8

src/hlua.c

index 4de5db5ac47629d6e0a08b1cc4ab38e56ce4011a..03e961c378f524791b76a3df6d23a1fcc2bda55c 100644 (file)
@@ -1799,7 +1799,6 @@ no_peer:
 
 connection_empty:
 
-       appctx = objt_appctx(s->si[0].end);
        if (!notification_new(&hlua->com, &appctx->ctx.hlua_cosocket.wake_on_read, hlua->task)) {
                xref_unlock(&socket->xref, peer);
                WILL_LJMP(luaL_error(L, "out of memory"));
@@ -1951,7 +1950,6 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext
         * the request buffer if its not required.
         */
        if (s->req.buf->size == 0) {
-               appctx = hlua->task->context;
                if (!channel_alloc_buffer(&s->req, &appctx->buffer_wait))
                        goto hlua_socket_write_yield_return;
        }
@@ -1959,7 +1957,6 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext
        /* Check for avalaible space. */
        len = buffer_total_space(s->req.buf);
        if (len <= 0) {
-               appctx = objt_appctx(s->si[0].end);
                if (!notification_new(&hlua->com, &appctx->ctx.hlua_cosocket.wake_on_write, hlua->task)) {
                        xref_unlock(&socket->xref, peer);
                        WILL_LJMP(luaL_error(L, "out of memory"));