bryancall commented on issue #12583:
URL: 
https://github.com/apache/trafficserver/issues/12583#issuecomment-4012517597

   In the meantime, here's a patch that should fix the issue. Rather than 
calling `cacheProcessor.remove()` (which recomputes the stripe via 
`key_to_stripe()` and can get a different one), it removes the directory entry 
directly on the stripe being scanned -- since we already have the correct `dir` 
entry from the `dir_probe` that found the object.
   
   Could you test this in your environment where you can reproduce the crash?
   
   ```diff
   diff --git a/src/iocore/cache/CacheVC.cc b/src/iocore/cache/CacheVC.cc
   index d230463e1b..fe61139541 100644
   --- a/src/iocore/cache/CacheVC.cc
   +++ b/src/iocore/cache/CacheVC.cc
   @@ -829,11 +829,14 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event 
* /* e ATS_UNUSED */)
        if (changed) {
          if (!vector.count()) {
            ink_assert(hostinfo_copied);
   -        SET_HANDLER(&CacheVC::scanRemoveDone);
   -        // force remove even if there is a writer
   -        cacheProcessor.remove(this, &doc->first_key, CACHE_FRAG_TYPE_HTTP,
   -                              std::string_view{hname, 
static_cast<std::string_view::size_type>(hlen)});
   -        return EVENT_CONT;
   +        // Remove the directory entry directly on the current stripe rather 
than
   +        // calling cacheProcessor.remove(), which recomputes the stripe via
   +        // key_to_stripe() and can return a different stripe than the one 
being
   +        // scanned -- causing the remove to fail and scanRemoveDone() to 
loop
   +        // back here on the same object indefinitely. See #12583.
   +        stripe->directory.remove(&doc->first_key, stripe, &dir);
   +        alternate.destroy();
   +        goto Lskip;
          } else {
            offset            = reinterpret_cast<char *>(doc) - buf->data();
            write_len         = 0;
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to