1. 22 Jan, 2021 1 commit
  2. 21 Jan, 2021 1 commit
    • Nils Goroll's avatar
      take note of an optimization we might want eventually · b682b691
      Nils Goroll authored
      ... which is not important enough for me to tackle it right now, in
      particular because I really do not understand enough about how this code
      works yet, e.g. which of the if() blocks can possibly happen in which
      order. *cough* fsm? *cough*
      b682b691
  3. 20 Jan, 2021 6 commits
    • Dridi Boukelmoune's avatar
      varnishncsa: Skip irrelevant transactions (again) · ad37cd85
      Dridi Boukelmoune authored
      This was already the behavior before #3468, but then the filtering was
      moved to libvarnishapi to prevent varnishncsa from duplicating the logic
      behind transaction collection.
      
      Unfortunately, despite libvarnishapi's effort to not consider a client or
      backend transaction without a Begin tag as a candidate, a transaction
      missing one will get a synthetic Begin prior to dispatch.
      
      Regardless, that would have only applied to vxid grouping so even if
      varnishncsa was presented by default with only relevant transactions, it
      could still see incomplete transactions in request grouping panic for
      the same reason.
      
      Fixes #3501
      ad37cd85
    • Nils Goroll's avatar
      VGC cstyle · 9ac1e8b0
      Nils Goroll authored
      do someone a favor and reformat the VPI_vcl_fini() call.
      
      Because ifp->fin basically gets output via "\t%s\n", this triggers my
      OCD in a some other way ;), but I am not going down that rabbit hole
      at this point...
      9ac1e8b0
    • Nils Goroll's avatar
      Flexelint d5bbb1a9 · cccb8c1d
      Nils Goroll authored
      We do not need to call trunc() to truncate a double into an integert.
      
      Mark the intention for flexelint with a cast.
      cccb8c1d
    • Nils Goroll's avatar
      Add missing bits of VRT_fail() handling during vcl_init {} / vcl_fini{} · e6f531bc
      Nils Goroll authored
      This change is based on the precondition that VRT_fail() should work
      wherever we have a VRT_CTX and DTRT, see also previous.
      
      on vcl_init {}
      --------------
      
      We already handled a "direct" VRT_fail() via a vmod function
      correctly.  This commit adds a test.
      
      Yet we can also VRT_fail() via a PRIV_TASK fini callback and did not
      handle that case (triggered an assertion in VRT_fail()). Notice that
      this case has worked in client / backend tasks for long and a test
      case has been added with 746384b2 . It
      has now gained relevance with 43d9e5fb
      
      on vcl_fini {}
      --------------
      
      By design, vcl_fini {} must not fail, which is also why the only valid
      return() value is "ok" (VCL_RET_OK).
      
      Consequently, we had
      
      	if (method && *ctx->handling && *ctx->handling != VCL_RET_OK) {
      		assert(ev == VCL_EVENT_LOAD);
      
      in vcl_send_event().
      
      And then came VRT_fail().
      
      If we wanted to sustain an assertion similar to the above, we would
      need to require vmod authors to never call VRT_fail() from
      VCL_MET_FINI - which would complicate code, be likely overlooked and
      receive little to no test coverage.
      
      So instead we now ignore errors during vcl_fini {} and emit a
      VCL_error log line.
      
      I considered the alternative to check for VCL_MET_FINI in VRT_fail(),
      but decided to handle the exception where it applies, which is in
      vcl_send_event().
      
      I am aware that this part of the change may trigger some controversy
      and I am open to discussing alternatives. If anything, we now avoid
      unmotivated assertion failures triggered for the new tests in
      v00051.vtc for the time being.
      e6f531bc
    • Nils Goroll's avatar
      Clarify (struct vrt_ctx).handling for PRIVs · 4ccd356d
      Nils Goroll authored
      Ref 43d9e5fb :
      
      PRIV_* fini methods need to leave (struct vrt_ctx).handling alone,
      except that they might call VRT_fail(), see also
      746384b2
      
      Thus we add assertions that handling be either 0 or VCL_RET_FAIL
      outside the FSM.
      
      To be able to do so, we need to change VCL_RET_OK into 0 when
      vcl_init{} has returned successfully.
      
      The vcl_fini{} case is slightly more complicated:
      
      By design, only "ok" (VCL_RET_OK) is allowed, but VRT_fail() also
      added VCL_RET_FAIL, so we de-facto get a "fail" return if any vmod
      code called VRT_fail().
      
      Because PRIV_* handling happens from VCC generated code via
      VGC_Discard(), we need to check and change (struct vrt_ctx).handling
      right after calling vcl_fini{} / VGC_function_vcl_fini() from
      VGC_Discard(). This is VPI_vcl_fini().
      
      Implementation note:
      
      I also considered void VPI_vcl_fini(VRT_CTX, vcl_func_f fini_sub),
      having VPI_vcl_fini call the fini_sub, but that stirred up includes of
      VPI where vcl.h is not included.
      4ccd356d
    • Nils Goroll's avatar
      rename debug.fail_rollback() & debug.ok_rollback() · 03757a35
      Nils Goroll authored
      Though introduced for the purpose of failing upon rollback, they
      actually just call VRT_fail() from the PRIV_* fini callback and thus
      should be named accordingly.
      03757a35
  4. 19 Jan, 2021 1 commit
  5. 18 Jan, 2021 28 commits
  6. 17 Jan, 2021 1 commit
  7. 16 Jan, 2021 2 commits