[XrdThrottle] Fix Throttle bug causing incorrect HTTP response #2483
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.
XrdHttp relies on a flag set by XrdXrootd indicating that the file being stat'd is cached. In turn, the stat flag is only set if the SFS layer claims to have the "cache" feature.
It turns out that the XrdThrottle class treated the
Features()function as if it was an overrided virtual when instead it was a non-virtual method in the base class with the following implementation:where
FeatureSetis a protected member.So, the features reported when the throttle is installed are just some defaults, not the actual features of the object it wraps.
The impact of the bug is the
Ageheader is never set for caches with the throttle installed. It was picked up by the Pelican integration tests when an upgrade to v5.8.0 was attempted.The fix for the bug sets the
FeatureSetmember inside the Throttle object based on the value returned by the object it wraps. To prevent future recurrences where a virtual function looks like it is overriding when it does not, I also added the proper annotations to the throttle header file.I would suggest considering making the
Features()function virtual in R6.