1. 13 Feb, 2024 3 commits
    • Dridi Boukelmoune's avatar
      v1f: Log a useful HTC status · 223847ea
      Dridi Boukelmoune authored
      Instead of adding hoops to the documentation, in particular to keep it
      in sync, improve the only location where we emit HTC status logs.
      
      We could also consider replacing the HTC enum with a struct, similar to
      what we did in other places. The struct symbols would be named after the
      UPPER name from the table, have a name and description fields, possibly
      replace the error number with a simple is_err field.
      
      Capturing the long description like this is less intrusive.
      
      Refs #4042
      223847ea
    • Dridi Boukelmoune's avatar
      7536a402
    • Dridi Boukelmoune's avatar
      v1l: restore errno on error · f364fa30
      Dridi Boukelmoune authored
      Spotted by Darryl Rodden.
      f364fa30
  2. 07 Feb, 2024 2 commits
  3. 05 Feb, 2024 6 commits
    • Nils Goroll's avatar
      Avoid deadlock in VRT_AddDirector() when VCL is going cold · f3575e38
      Nils Goroll authored
      If VRT_AddDirector() was called from handling a VCL_COLD event or,
      indirectly, from another thread which the VCL_COLD event handler was
      waiting for, varnishd would deadlock and prevent any CLI or director
      changes, because VRT_AddDirector() requires the vcl_mtx, which is held
      during vcl_BackendEvent() to ensure a consistent view of the director
      list. Because of the early return from VRT_AddDirector() this likely
      only happened in VTC mode, but the underlying race existed
      nevertheless.
      
      This patch _almost_ fixes the issue with the intend of making it
      highly unlikely to occur without getting too involved with the vcl
      temperature controls: We now check the same conditions under which
      vcl_set_state() would transition the temperature to COOLING and, if
      they apply, use Lck_Trylock() in a try/wait loop instead of
      Lck_Lock(), avoiding the deadlock.
      
      The patch presumably still does not fix the problem entirely, because
      the reads of vcl->busy and vcl->temp before the Lck_Trylock() could
      still be outdated. With the temperature controls otherwise unchanged,
      the only alternative idea I could come up with was to always use a
      try/wait loop, which I dismissed due to the performance impact
      (overhead and added latency).
      
      Ref https://github.com/nigoroll/libvmod-dynamic/issues/110
      f3575e38
    • Dridi Boukelmoune's avatar
      v1p: Use VTIM_poll_tmo() · 17fa3865
      Dridi Boukelmoune authored
      Otherwise poll(2) returns EINVAL on FreeBSD when both pipe_timeout and
      pipe_task_deadline are disabled.
      
      Fixes #4043
      17fa3865
    • Dridi Boukelmoune's avatar
      33e69f02
    • Dridi Boukelmoune's avatar
      vtim: New VTIM_poll_tmo() converter · f383b5c3
      Dridi Boukelmoune authored
      It takes a vtim_dur and returns a number of milliseconds. NAN means no
      timeout and negative values are considered expired deadlines and get a
      chance to succeed a non-blocking poll.
      f383b5c3
    • Dridi Boukelmoune's avatar
      vtc: Increase stack size for 32bit systems in e29 · 8d956aec
      Dridi Boukelmoune authored
      This test case has been failing for a while in continuous integration
      and trying to bisect the change that triggered a stack overflow for our
      Ubuntu 18.04 job I wasn't able to make it pass, even for the commit
      where it first landed.
      
      Something must have happened outside of Varnish to consume more stack.
      8d956aec
    • Dridi Boukelmoune's avatar
      vrt_var: Make bereq.task_deadline unset-able · 1ff0c0f4
      Dridi Boukelmoune authored
      The other timeouts should eventually become unset-able as well, where
      an unset variable falls back to a parameter and zero means no timeout,
      overriding the fallback parameter.
      
      Refs #4043
      1ff0c0f4
  4. 01 Feb, 2024 1 commit
  5. 31 Jan, 2024 9 commits
    • Dridi Boukelmoune's avatar
      0959f355
    • Dridi Boukelmoune's avatar
      vrt_var: Expose bereq.task_deadline in vcl_pipe · 48170767
      Dridi Boukelmoune authored
      The [be]req.task_deadline should eventually be generalized to all
      subroutines with read-write access to [be]req. When that happens,
      bereq.task_deadline will inherit req.task_deadline during the pipe
      transition.
      
      Related tasks should otherwise have independent deadlines, except
      sub-request tasks like ESI where there is a hierarchical dependency.
      48170767
    • Dridi Boukelmoune's avatar
      doc: Succinctly describe parameters units · 490553b0
      Dridi Boukelmoune authored
      This takes care of documenting the meaning of a zero timeout value in
      a central location, since none of the timeout parameters have a mention
      for the effect it produces.
      
      This is written as if there was a separate varnish-param(7) manual,
      which should eventually be enacted. This manual extraction was initially
      implemented in the adjacent #3817 timeout nomenclature draft.
      490553b0
    • Dridi Boukelmoune's avatar
      bb644147
    • Dridi Boukelmoune's avatar
      32215660
    • Dridi Boukelmoune's avatar
      v1p: Refine stream_close_t outcome · 7eb20abe
      Dridi Boukelmoune authored
      7eb20abe
    • Dridi Boukelmoune's avatar
      660fedef
    • Nils Goroll's avatar
      Polish · e0b164f9
      Nils Goroll authored
      e0b164f9
    • Nils Goroll's avatar
      Fix surplus vcldir cleanup · c096659d
      Nils Goroll authored
      in VRT_AddDirector, we create the new vcldir with an initial
      reference, which we need to drop if we can not add it.
      
      Compare:
      
      	VRT_AddDirector()
      		...
      		vdir->refcnt++;
      
      	vcldir_free()
      		...
      		AZ(vdir->refcnt);
      
      Noticed when testing other experimental changes while working on
      https://github.com/nigoroll/libvmod-dynamic/issues/110
      
       #5  0x000055820c8cb845 in VAS_Fail (func=0x55820c904559 "vcldir_free", file=0x55820c903a47 "cache/cache_vrt_vcl.c",
           line=150, cond=0x55820c90459a "(vdir->refcnt) == 0", kind=VAS_ASSERT) at vas.c:67
       #6  0x000055820c83a442 in vcldir_free (vdir=0x7f662aa53140) at cache/cache_vrt_vcl.c:150
       #7  0x000055820c839fe1 in VRT_AddDirector (ctx=0x7f662befe250, m=0x55820c965260 <vbe_methods_noprobe>,
           priv=0x7f662aa20780, fmt=0x55820c900f7f "%s") at cache/cache_vrt_vcl.c:219
       #8  0x000055820c7c7c4d in VRT_new_backend_clustered (ctx=0x7f662befe250, vc=0x0, vrt=0x7f662befdd10, via=0x0)
          at cache/cache_backend.c:737
       #9  0x000055820c7c8632 in VRT_new_backend (ctx=0x7f662befe250, vrt=0x7f662befdd10, via=0x0)
           at cache/cache_backend.c:755
      c096659d
  6. 29 Jan, 2024 2 commits
  7. 26 Jan, 2024 6 commits
  8. 24 Jan, 2024 2 commits
  9. 22 Jan, 2024 2 commits
  10. 18 Jan, 2024 1 commit
  11. 15 Jan, 2024 6 commits