varnish / varnish-modules

Collection of Varnish Cache modules (vmods) by Varnish Software
Other
185 stars 86 forks source link

fix(vmod_var): gracefully handle WS_Alloc failures #196

Closed dhamidi closed 2 years ago

dhamidi commented 2 years ago

The assumption that WS_Alloc always returns a non-NULL value is not true, which can lead to the AN(v) following the call to WS_Alloc in vmod_var to kill the varnish child process, resulting in a loss of the cache.

Instead of panicking due to a failed assertion, this commit introduces a check of the return value of WS_Alloc and fails the request in case not enough memory was available for allocating a new variable.

gquintard commented 2 years ago

merged, thank you very much!

gquintard commented 2 years ago

Ah, would you mind porting that PR to the 7.0 and 7.1 branches please?

dhamidi commented 2 years ago

Thanks, I was wondering about how that works :)

gquintard commented 2 years ago

Ah, fairly easy: there are going to be 4 active branch: master, the latest release (7.1 at the moment), the one before that (7.0) and the LTS (6.0), and we just try to commit in all them.

On Tue, Mar 22, 2022, 04:20 Dario Hamidi @.***> wrote:

Thanks, I was wondering about how that works :)

— Reply to this email directly, view it on GitHub https://github.com/varnish/varnish-modules/pull/196#issuecomment-1075046702, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA42AKJQ7L5WKMYUHP24PM3VBGUIXANCNFSM5RBHAYXQ . You are receiving this because you modified the open/close state.Message ID: @.***>