stack ws workspace for pcre and others #1576
fgsch at lodoss.net
Tue Sep 2 19:56:05 CEST 2014
Only problem is that it's a build option.
Increasing the stack space will only work as long as the regex doesn't
recurse more than the stack space allows.
Not sure what's the best solution here but we should avoid crashing.
On Tue, Sep 2, 2014 at 6:12 PM, Nils Goroll <slink at schokola.de> wrote:
> on the weekend I have actually stumbled over the same cause that bug #1576
> (but unfortunately have not immediately realized the connection) and have
> changed our dcs_classifier vmod (which needs some reasonably large scratch
> memory in the order of ~64k) to use the client workspace rather than stack.
> Using the workspace seemed more reasonable as varnish core structures have
> moved away from the stack and I thought it would be more advantagous to
> a workspace size than increase the stack size (which has a nice tiny
> default of
> 48k now).
> But then Ferdericos comment in #1576 made me re-think this:
> > Comment (by fgsch):
> > This is actually related to the thread_pool_stack size.
> > Bumping the value to 49k make the test work. Lowering pcre_match_limit
> > makes the match fail without crashing.
> > Should we reduce the pcre_match_limit to something more sensible? 10000
> > seems like a rather large value.
> If we were to need a larger default stack for pcre anyway, it wouldn't make
> sense to move scratch space to a WS.
> On the other hand, we might as well consider to give pcre space from
> Compiling PCRE to use heap instead of stack for pcre_exec()
> In environments where stack memory is constrained, you might want to
> compile PCRE to use heap memory instead of stack for remember‐
> ing back-up points when pcre_exec() is running. This makes
> it run
> a lot more slowly, however. Details of how to do this are
> given in the pcrebuild documentation. When built in this way,
> instead of
> using the stack, PCRE obtains and frees memory by calling
> the functions that are pointed to by the pcre_stack_malloc and
> pcre_stack_free variables. By default, these point to mal‐
> loc() and free(), but you can replace the pointers to cause PCRE to
> your own functions. Since the block sizes are always the
> same, and are always freed in reverse order, it may be possible
> implement customized memory handlers that are more efficient
> than the standard functions.
> So we could simply hand the free space of some ws to pcre via some
> Whatever we do, we should either try to minimize ws usage or stack usage,
> but do
> it consequently for all components.
> varnish-dev mailing list
> varnish-dev at varnish-cache.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the varnish-dev