Fix cache test reenable loop in VC_EVENT_READ_READY handler #12712
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
test_cache_Populated_Cacheunit test was failing with "Subprocess aborted" showing thousands of repeated reenable calls on the same CacheVC object. The Jenkins CI logs showed an infinite loop of reenable messages:https://ci.trafficserver.apache.org/job/master/job/os_build/47228/console
Root Cause
In
src/iocore/cache/unit_tests/main.cc, theCacheReadTest::read_eventhandler was callingprocess_event()inside the while loop that consumes data blocks:This meant
reenable()was being called for every block of data, which is incorrect. When reading from a populated cache with many blocks, this resulted in excessive reenables and triggered the test abort.The Fix
Move the
process_event()call outside the while loop soreenable()is only called once per event after all available data has been consumed:This matches the pattern used in
CacheTestSM(the production regression test code) and follows standard async I/O patterns: consume all available data, then signal readiness for more.Testing
test_cache_Cache- Passed (fresh cache)test_cache_Populated_Cache- Passed (previously failing)The fix reduces reenable calls from thousands to just a handful per test run.