zwoop commented on code in PR #12949:
URL: https://github.com/apache/trafficserver/pull/12949#discussion_r2902330701
##########
plugins/slice/prefetch.cc:
##########
@@ -132,15 +175,15 @@ BgBlockFetch::handler(TSCont contp, TSEvent event, void *
/* edata ATS_UNUSED */
case TS_EVENT_ERROR:
bg->m_stream.abort();
TSContDataSet(contp, nullptr);
- delete bg;
TSContDestroy(contp);
+ bg->m_config->prefetchRelease(bg);
break;
case TS_EVENT_VCONN_READ_COMPLETE:
case TS_EVENT_VCONN_EOS:
bg->m_stream.close();
TSContDataSet(contp, nullptr);
- delete bg;
TSContDestroy(contp);
+ bg->m_config->prefetchRelease(bg);
Review Comment:
As intended. Remap instances in ATS are ref-counted, so `Config` is
guaranteed to outlive all outstanding background fetch continuations that hold
a pointer to it — the instance won't be torn down while connections are still
active. `BgBlockFetch` objects are properly recycled via `prefetchRelease()`
(freelist) and ultimately freed in `prefetchCleanup()` when the `Config`
destructor runs.
--
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]