BUG/MAJOR: lua: properly dequeue hlua_applet_wakeup() for new scheduler
The recent scheduler change broke the Lua co-sockets due to hlua_applet_wakeup() returning NULL after waking the applet up. With the previous scheduler, returning NULL was a way to do nothing on return. With the new one it keeps TASK_RUNNING set, causing all new notifications to end up into t->pending_state instead of t->state, and prevents the task from being added into the run queue again, so and it's never woken up anymore. The applet keeps waking up, causing hlua_socket_handler() to do nothing new, then si_applet_wake_cb() calling stream_int_notify() to try to wake the task up, which it can't do due to the TASK_RUNNING flag, then decide that since the associated task is not in the run queue, it needs to call stream_int_update_applet() to propagate the update. This last one finds that the applet needs to be woken up to deal with the last reported events and calling appctx_wakeup() again. Previously, this situation didn't exist because the task was always added in the run queue despite the TASK_RUNNING flag. By returning the task instead in hlua_applet_wakeup(), we can ensure its flag is properly cleared and the task is requeued if needed or just sits waiting for new events to happen. This fix requires the previous ones ("BUG/MINOR: lua: always detach the tcp/http tasks before freeing them") and MINOR: task: always preinitialize the task's timeout in task_init(). Thanks to Thierry, Christopher and Emeric for the long head-scratching session! No backport is needed as the bug doesn't appear in older versions and it's unsure whether we'll not break something by backporting it.
This commit is contained in:
parent
f1d33db10a
commit
d1aa41f83b
@ -5971,7 +5971,7 @@ struct task *hlua_applet_wakeup(struct task *t)
|
||||
*/
|
||||
si_applet_cant_put(si);
|
||||
appctx_wakeup(ctx);
|
||||
return NULL;
|
||||
return t;
|
||||
}
|
||||
|
||||
static int hlua_applet_tcp_init(struct appctx *ctx, struct proxy *px, struct stream *strm)
|
||||
|
Loading…
x
Reference in New Issue
Block a user