[PATCH] The default stack should have room for the 32k jit requires

Nils Goroll slink at schokola.de
Mon May 18 12:13:43 CEST 2015


As discussed here http://comments.gmane.org/gmane.comp.web.varnish.dev/2400 and
on irc today, I am unhappy about the decision to use JIT unconditionally, but
if we do, we should at least provide more than 16k stack for the rest of VRT.
---
 bin/varnishd/mgt/mgt_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 533ec80..f645245 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -382,7 +382,13 @@ init_params(struct cli *cli)
 	bprintf(stackmin, "%jd", (intmax_t)low);
 	MCF_SetMinimum("thread_pool_stack", stackmin);

+#if defined(USE_PCRE_JIT) && PCRE_MAJOR == 8 && PCRE_MINOR >= 32
+	// jit always needs 32k on the stack
+	def = (48 + 32) * 1024;
+#else
+	// recursive pcre may need less stack but may also trigger a stack overflow
 	def = 48 * 1024;
+#endif
 	if (def < low)
 		def = low;
 	bprintf(stackdef, "%jd", (intmax_t)def);
-- 
2.1.4




More information about the varnish-dev mailing list