Commit c9bf6534 authored by Nils Goroll's avatar Nils Goroll

fix forgotten WS_Release() calls for failing WS_Reserve()

This should hopefully fix a panic which has to be caused by forgotten
WS_Release() calls and which occurred close to VCL code which handles
re2 sets.

Redacted panic:

Panic at: Fri, 05 Apr 2019 19:15:24 GMT
Assert error in WS_Reserve(), cache/cache_ws.c line 236:
  Condition(ws->r == NULL) not true.
version = varnish-trunk revision af2bad23deb2470533158f9d99ad3f4968b8d231, vrt api = 9.0
ident = Linux,3.13.0-137-generic,x86_64,-junix,-smalloc,-sdefault,-hcritbit,epoll
now = 3999664.335146 (mono), 1554491669.714933 (real)
Backtrace:
  0x43c1bb: /usr/sbin/varnishd() [0x43c1bb]
  0x49e182: /usr/sbin/varnishd(VAS_Fail+0x42) [0x49e182]
  0x45d1ac: /usr/sbin/varnishd() [0x45d1ac]
  0x44d792: /usr/sbin/varnishd(VRT_String+0x22) [0x44d792]
  0x44de66: /usr/sbin/varnishd(VRT_SetHdr+0xf6) [0x44de66]
  ...(redacted for customer proprietary information)

See also https://github.com/varnishcache/varnish-cache/issues/2967
for a general discussion regarding an inconsistency in the WS_Reserve()
interface
parent 5e9690dd
......@@ -202,6 +202,7 @@ rewritef(VRT_CTX, vre2 * restrict vre2, const rewrite_e mode, VCL_STRING text,
if (bytes == 0) {
VERR(ctx, ERR_PREFIX "workspace overflow", rewrite_name[mode],
text, rewrite, fallback);
WS_Release(ctx->ws, 0);
return fallback;
}
if ((err = vre2_rewrite(vre2, mode, text, rewrite, ret, bytes, &match,
......@@ -758,6 +759,7 @@ vmod_quotemeta(VRT_CTX, VCL_STRING unquoted, VCL_STRING fallback)
bytes = WS_Reserve(ctx->ws, 0);
if (bytes == 0) {
VERR(ctx, ERR_PREFIX "workspace overflow", unquoted, fallback);
WS_Release(ctx->ws, 0);
return fallback;
}
if ((err = vre2_quotemeta(unquoted, ret, bytes, &len)) != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment