AZ(pthread_key_create) fails if Varnish has been running long enough
After an uptime of 41 days, vcl.load with RE object initializations in vcl_init was causing Varnish to crash due to this assertion failure:
#2 0x000000000043ce98 in pan_ic (func=0x2ba69e8025f0 "vmod_regex__init", file=0x2ba69e802112 "vmod_re.c", line=96, cond=0x2ba69e802518 "(pthread_key_create(&re->ovk, ((void *)0))) == 0", err=1, kind=VAS_ASSERT) at cache/cache_panic.c:513 #3 0x00002ba69e801962 in vmod_regex__init (ctx=<value optimized out>, rep=0x2ba6c0296ae8, vcl_name=<value optimized out>, pattern=0x2ba6c0037256 <Address 0x2ba6c0037256 out of bounds>) at vmod_re.c:96
errno==1==EPERM=="Operation not permitted" on Linux, but I'm inclined to believe that there were just too many VCLs accumulated, too many RE objects, and we may have hit a limit for pthread keys. The VMOD may have to do a better job of cleaning up pthread keys when they are unused.