1. 15 Jul, 2023 5 commits
  2. 10 Jul, 2023 5 commits
    • Nils Goroll's avatar
      140077ad
    • Nils Goroll's avatar
      Handle a race between stvfe_mutate() and stvfe_dskoc_fco() · 36aee12b
      Nils Goroll authored
      In stvfe_dskoc_fco() we change the oc's stevedore to memstv only
      _after_ we have taken a refernce via fellow_cache_obj_get() and thus
      potentially put the fco onto the lru list.
      
      This order is important, because other requests racing on
      stvfe_dskoc_fco() need to also go through fellow_cache_obj_get() until
      the memstv object has been established for real.
      
      Yet this opens a window for a window where an fco is on LRU with
      oc->stobj->stevedore still set to dskstv, even without dirty reads,
      and even more so with dirty reads.
      
      Because any additional synchronization here could kill performance, we
      handle this outdated read in stvfe_mutate by not touching the object
      (yet). It will be hit the next time we iterate the LRU list.
      
      Fixes #13, hopefully.
      36aee12b
    • Nils Goroll's avatar
      Refactor local variables in stvfe_mutate() · 80065a8b
      Nils Goroll authored
      80065a8b
    • Nils Goroll's avatar
      Make memstv assertions more precise · 62b07c22
      Nils Goroll authored
      Because of #14 I would like to understand if #13 is really a genuine
      bug or some odd consequence
      62b07c22
    • Nils Goroll's avatar
      fellow: fini stevedore_priv / call fellow_busy_done() also for objfree · ba4d52f5
      Nils Goroll authored
      This bug was also present in varnish-cache (will document) and found
      its way into fellow through the api-definition-by-example paradigm of
      varnish-cache:
      
      In varnish-cache vbf_stp_error(), an existing storage object is freed
      to be replaced with a new one, potentially from a different storage
      (usually -sTransient).
      
      In this case, ObjBocDone is not called, because the boc is to be
      preserved - from the client's perspective, the backend transaction is
      still in progress, and the client is waiting for the busy object to
      finish.
      
      At the storage level, however, the process of creation of a new object
      _is_ finished, and any busy object state which the storage might keep
      needs to be finalized.
      
      So, if oc->boc is not NULL for an ObjFreeObj() call, the stevedore
      needs to finish any busy object transaction.
      
      Fixes #14
      ba4d52f5
  3. 17 Apr, 2023 3 commits
  4. 10 Apr, 2023 2 commits
  5. 07 Apr, 2023 6 commits
  6. 27 Mar, 2023 1 commit
  7. 20 Mar, 2023 1 commit
  8. 02 Mar, 2023 5 commits
  9. 01 Mar, 2023 6 commits
    • Nils Goroll's avatar
      Fix objiterator_f prototype decorations · 85806903
      Nils Goroll authored
      85806903
    • Nils Goroll's avatar
      Update generated RST · 4b045170
      Nils Goroll authored
      4b045170
    • Nils Goroll's avatar
      8f72a7ed
    • Nils Goroll's avatar
      Try to improve the documentation on registered buffers · 4db4cb48
      Nils Goroll authored
      It seems to have caused confusion regarding the relation between io_uring
      and the fellow memory cache, which exists only to the extent that io_uring
      manages IO in and out of it.
      4db4cb48
    • Nils Goroll's avatar
    • Nils Goroll's avatar
      Add missing bits for full streaming support · 97578b06
      Nils Goroll authored
      Previous code would only deliver fully received segments even if a
      busy object was being written to by the backend side (streaming).
      
      I guess at some point before the public release I must have thought
      about this and decided that streaming only completed segments should
      be acceptable at least to begin with, but I overlooked the fact that
      the previous implementation could lead to short body writes due to a
      lack of coordination between the writing and reading side.
      
      This commit introduces proper streaming support, also within busy
      segments.
      
      In particular, this should also solve an issue reported by @tomazz75
      on gitlab where no body was sent at all. This problem could lead to
      the client stalling on a wait for body data which never came.
      
      The nature of this problem was a race condition, which I was only able
      to reproduce on my system with the following patch to favor the race:
      
      diff --git a/src/fellow_cache.c b/src/fellow_cache.c
      index 3073b35..c9d9a4e 100644
      --- a/src/fellow_cache.c
      +++ b/src/fellow_cache.c
      @@ -3338,6 +3338,9 @@ fellow_busy_obj_getspace(struct fellow_busy *fbo, size_t *sz, uint8_t **ptr)
              assert(*sz > 0);
              AN(ptr);
      
      +       // XXX DEBUG
      +       usleep(10000);
      +
              CHECK_OBJ_NOTNULL(fbo->fc, FELLOW_CACHE_MAGIC);
              CHECK_OBJ_NOTNULL(fbo->fc->tune, STVFE_TUNE_MAGIC);
              max = (size_t)1 << fbo->fc->tune->chunk_exponent;
      
      This fix survived 1000 calls to the respective test case:
      
      	/tmp/bin/varnishtest \
      		-Dlibvmod_slash=/tmp/lib/varnish/vmods/libvmod_slash.so \
      		src/vtc/fellow_c00093.vtc \
      		-n 1000 -j 20
      
      Thank you to @tomazz75 for reporting the bug and help with additional
      information to track it down.
      
      Fixes #2
      97578b06
  10. 28 Feb, 2023 4 commits
  11. 27 Feb, 2023 2 commits