BUG/MEDIUM: httpclient/lua: double LIST_DELETE on end of lua task
The lua httpclient cleanup can be called in 2 places, the hlua_httpclient_gc() and the hlua_httpclient_destroy_all(). A LIST_DELETE() is performed to remove the hlua_hc struct of the list. However, when the lua task ends and call hlua_ctx_destroy(), it does a LIST_DELETE() first, and then the gc tries to do a LIST_DELETE() again in hlua_httpclient_gc(), provoking a crash. This patch fixes the issue by doing a LIST_DEL_INIT() instead of LIST_DELETE() in both cases. Should fix issue #1958. Must be backported where bb58142 is backported. (cherry picked from commit 94dbfedec138101f314d746dab87caa3a1760b59) Signed-off-by: Christopher Faulet <cfaulet@haproxy.com> (cherry picked from commit c177de37d8f68a9434530e4f5706efdaa2b934b5) Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
parent
abb8b15c9b
commit
7b6a3c0575
@ -1251,7 +1251,7 @@ static void hlua_httpclient_destroy_all(struct hlua *hlua)
|
||||
if (hlua_hc->hc)
|
||||
httpclient_stop_and_destroy(hlua_hc->hc);
|
||||
hlua_hc->hc = NULL;
|
||||
LIST_DELETE(&hlua_hc->by_hlua);
|
||||
LIST_DEL_INIT(&hlua_hc->by_hlua);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7007,10 +7007,8 @@ __LJMP static int hlua_httpclient_gc(lua_State *L)
|
||||
if (hlua_hc->hc)
|
||||
httpclient_stop_and_destroy(hlua_hc->hc);
|
||||
|
||||
LIST_DELETE(&hlua_hc->by_hlua);
|
||||
|
||||
hlua_hc->hc = NULL;
|
||||
|
||||
LIST_DEL_INIT(&hlua_hc->by_hlua);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user