regsub(all?) input limit

Christian Ruppert idl0r at
Thu Dec 3 14:05:44 CET 2015

On 2015-12-03 13:31, Carlos Abalde wrote:
>> On 03 Dec 2015, at 13:12, Christian Ruppert <idl0r at> wrote:
>> Hi,
>> I just noticed that regsub and likely regsuball will just return the 
>> untouched input string if it exceeds 57118 bytes. Is it intended to do 
>> so, performance reasons perhaps?
>> In this case it's a custom error page with some (eye candy) embedded 
>> images and in total a bit above the mentioned size. The regsub should 
>> actually just replace a pattern with the XID, in this case simply 
>> regsub(..., "bereq\.xid", bereq.xid).
> Hi Christian,
> You're probably hitting the workspace_client (or workspace_backend)
> limit. Those are varnishd parameters [1] that default to 64k. I've not
> checked the regsub implementation, but I guess it is not able to
> allocate enough memory in the workspace and in that case it simply
> returns the original input string (the alternative would be returning
> NULL or killing the child process in an assertion). Try to increase
> those parameters and try your test again.
> [1]
> Best,
> --
> Carlos Abalde

Hi Carlos,

thanks for your fast reply! :)
You're right! Setting workspace_backend to at least 429k helps in this 
case. 64k vs. >429k is quite a lot tough. So that will be allocated for 
each backend req/resp? Is take from the space set by "-s" or 
additionally? Is there any better way to set the XID, instead of using 
smaller images? I'm not sure about the drawbacks when setting 
workspace_backend to e.g. 512k.

Christian Ruppert

More information about the varnish-misc mailing list