• Nils Goroll's avatar
    fix assertion on unexpected vdp order for gzip-in-gunzip case · 490b4cdc
    Nils Goroll authored
    For the case of gzip included in plain response, the esi_level == 1 vdp
    order was:
    
    	pesi gunzip pesi_buf V2P(to_parent)
    
    Yet we had assertions in place that pesi_buf always immediately follows
    pesi.
    
    The reason was that, for esi_level > 0, we would not push pesi_buf from
    pesi init but rather from the transport, which was plain wrong: We
    should delay any additional vdps in order to buffer the least amount of
    data.
    
    Working on this, I also noted that for the generic buffering case, our
    assertion that pesi_buf is first, might be too strict. Now, any VDPs
    before the buffer are being closed at esi_level > 1.
    
    fixes this panic:
    
    Assert error in vped_close_vdp(), vdp_pesi.c line 1182:
      Condition(vdpe->vdp == vdp) not true.
    
    	...
    
    Backtrace:
      0x43cf3b: /usr/sbin/varnishd() [0x43cf3b]
      0x4a01c2: /usr/sbin/varnishd(VAS_Fail+0x42) [0x4a01c2]
      0x7f3719306b63:
    ./vmod_cache/_vmod_pesi.4d9e0603bac2a2e2b2627f7fe90ff1d55d4759545517c869a5571f16636e230e(+0x8b63)
    [0x7f3719306b63]
      0x7f371930a377:
    ./vmod_cache/_vmod_pesi.4d9e0603bac2a2e2b2627f7fe90ff1d55d4759545517c869a5571f16636e230e(+0xc377)
    [0x7f371930a377]
      0x441eab: /usr/sbin/varnishd(CNT_Request+0x11ab) [0x441eab]
      0x7f3719308043:
    ./vmod_cache/_vmod_pesi.4d9e0603bac2a2e2b2627f7fe90ff1d55d4759545517c869a5571f16636e230e(+0xa043)
    [0x7f3719308043]
      0x45c833: /usr/sbin/varnishd() [0x45c833]
      0x45ccf0: /usr/sbin/varnishd() [0x45ccf0]
      0x7f37e6d18e65: /lib64/libpthread.so.0(+0x7e65) [0x7f37e6d18e65]
      0x7f37e6a4188d: /lib64/libc.so.6(clone+0x6d) [0x7f37e6a4188d]
    thread = (cache-worker)
    pthread.attr = {
      guard = 4096,
      stack_bottom = 0x7f372c482000,
      stack_top = 0x7f372c502000,
      stack_size = 524288,
    }
    thr.req = 0x7f3601106020 {
      vxid = 25559391, transport = PESI_INCLUDE
      step = R_STP_TRANSMIT,
      req_body = R_BODY_NONE,
      restarts = 0, esi_level = 1,
    
    	...
    490b4cdc
gzip-in-plain.vtc 2.56 KB