]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: hlua: Initialize appctx used by a lua socket on connect only
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 Sep 2023 15:47:45 +0000 (17:47 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 4 Oct 2023 13:34:13 +0000 (15:34 +0200)
commit751b59c40bad0a0d7c362d05b44053260cdecc97
tree9f2c434734649a30f51bd0a9e00d1cc4d2d6b871
parent66fc9238f0c9860c2edd083ca87d0267faf44c5e
BUG/MEDIUM: hlua: Initialize appctx used by a lua socket on connect only

Ths appctx used by a lua socket was synchronously initialized after the
appctx creation. The connect itself is performed later. However it is an
issue because the script may be interrupted beteween the two operation. In
this case, the stream attached to the appctx is woken up before any
destination is set. The stream will try to connect but without destination,
it fails. When the lua script is rescheduled and the connect is performed,
the connection has already failed and an error is returned.

To fix the issue, we must be sure to not woken up the stream before the
connect. To do so, we must defer the appctx initilization. It is now perform
on connect.

This patch relies on the following commits:

  * MINOR: hlua: Test the hlua struct first when the lua socket is connecting
  * MINOR: hlua: Save the lua socket's server in its context
  * MINOR: hlua: Save the lua socket's timeout in its context
  * MINOR: hlua: Don't preform operations on a not connected socket
  * MINOR: hlua: Set context's appctx when the lua socket is created

All the series must be backported as far as 2.6.
src/hlua.c