From: Emeric Brun Date: Mon, 29 May 2017 13:26:51 +0000 (+0200) Subject: MINOR: task/stream: tasks related to a stream must be init by the caller. X-Git-Tag: v1.8-dev3~274 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f77fef34e76f20fe62f3e4102559c1e0fe8f5a1;p=thirdparty%2Fhaproxy.git MINOR: task/stream: tasks related to a stream must be init by the caller. 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. --- diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 9288de99fa..e59922cf82 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -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 */ diff --git a/src/hlua.c b/src/hlua.c index b8d2c88de3..85e0c664ea 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -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; diff --git a/src/peers.c b/src/peers.c index 7f63aa9fc7..643b8c52a5 100644 --- a/src/peers.c +++ b/src/peers.c @@ -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 */ diff --git a/src/session.c b/src/session.c index 34250eb537..46b9f67e3c 100644 --- a/src/session.c +++ b/src/session.c @@ -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: diff --git a/src/stream.c b/src/stream.c index bc8b3af138..78748373f9 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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 */