]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: task/stream: tasks related to a stream must be init by the caller.
authorEmeric Brun <ebrun@haproxy.com>
Mon, 29 May 2017 13:26:51 +0000 (15:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 27 Jun 2017 12:38:02 +0000 (14:38 +0200)
The task_wakeup was called on stream_new, but the task/stream
wasn't fully initialized yet. The task_wakeup must be called
explicitly by the caller once the task/stream is initialized.

src/flt_spoe.c
src/hlua.c
src/peers.c
src/session.c
src/stream.c

index 9288de99fa0c7c9f0109526619793921d0716780..e59922cf8238fc3b4581f6cc0fdb39a75ec9593d 100644 (file)
@@ -1960,6 +1960,8 @@ spoe_create_appctx(struct spoe_config *conf)
        task_wakeup(SPOE_APPCTX(appctx)->task, TASK_WOKEN_INIT);
        LIST_ADDQ(&conf->agent->applets, &SPOE_APPCTX(appctx)->list);
        conf->agent->applets_act++;
+
+       task_wakeup(task, TASK_WOKEN_INIT);
        return appctx;
 
        /* Error unrolling */
index b8d2c88de3f859544c6ff94178da8c6e25313693..85e0c664ea85f5cde8660bdb44cf971ba3dd54b5 100644 (file)
@@ -2353,6 +2353,7 @@ __LJMP static int hlua_socket_new(lua_State *L)
        jobs++;
        totalconn++;
 
+       task_wakeup(task, TASK_WOKEN_INIT);
        /* Return yield waiting for connection. */
        return 1;
 
index 7f63aa9fc7d65396ad6024bbc3183314d0275393..643b8c52a51be67699f96ac1097ed42d8ae3da72 100644 (file)
@@ -1835,6 +1835,7 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
        totalconn++;
 
        peer->appctx = appctx;
+       task_wakeup(t, TASK_WOKEN_INIT);
        return appctx;
 
        /* Error unrolling */
index 34250eb53719179ff8e5cfeb490ba02d41930ff6..46b9f67e3c9c58e754f6fa70dba03e5c7c0dc895 100644 (file)
@@ -276,6 +276,7 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr
        strm->target         = sess->listener->default_target;
        strm->req.analysers |= sess->listener->analysers;
 
+       task_wakeup(t, TASK_WOKEN_INIT);
        return 1;
 
  out_free_task:
@@ -446,6 +447,7 @@ static int conn_complete_session(struct connection *conn)
        strm->req.analysers |= sess->listener->analysers;
        conn->flags &= ~CO_FL_INIT_DATA;
 
+       task_wakeup(task, TASK_WOKEN_INIT);
        return 0;
 
  fail:
index bc8b3af138a1b0ff60aa2a668b136d97c6c76de3..78748373f9e04460c67c6b6a79027f5626d2a7d8 100644 (file)
@@ -239,9 +239,10 @@ struct stream *stream_new(struct session *sess, struct task *t, enum obj_type *o
 
        /* it is important not to call the wakeup function directly but to
         * pass through task_wakeup(), because this one knows how to apply
-        * priorities to tasks.
+        * priorities to tasks. Using multi thread we must be sure that
+        * stream is fully initialized before calling task_wakeup. So
+        * the caller must handle the task_wakeup
         */
-       task_wakeup(t, TASK_WOKEN_INIT);
        return s;
 
        /* Error unrolling */