I’d like to add this new TS API: /** Check to see if an MBuffer is still valid, from since the time it was acquired. */ bool TSMBufferIsValid(TSMBuffer bufp);
The intent of this API is to check if a TSMbuffer, and any pointers related to this buffer, are still valid. Why would they not be, you ask? There are cases where these heap buffers are coalesced, and when that happens, the pointers you may have fetched earlier, are no longer valid. Today, there’s no way to know if your pointers and buffers are valid, The new API, and the changes to the core and APIs it comes with, allows a plugin, or a plugin framework such as txn_box, to verify that saved (or cached) pointers are still valid. For Cripts, it has to invalidate all saved pointers between every hook, even though more often than not, it could have kept them (they are stored and saved in a transaction context). With this addition, Cripts (and txn_box) could keep values around for much longer, and check with this new API if these cached pointers are still valid. I’d imagine similar optimizations could now be added to e.g. header_rewrite and other plugins as well (keeping state between hooks). The proposed API, and changes are in this PR: https://github.com/apache/trafficserver/pull/11780 Thanks, — Leif