Aias00 opened a new issue, #7977:
URL: https://github.com/apache/shenyu/issues/7977

   ### Is there an existing issue for this?
   
   - [x] I have searched the existing issues
   
   ### Current Behavior
   
   When no selector matches, defaultMatchSelector creates an empty selector and 
caches it by plugin/path. The empty-ID branch bypasses the URI-only eligibility 
check. A request missing a required header can therefore suppress a subsequent 
request on the same path that supplies the header. 
defaultMatchRule/cacheRuleData use the same negative-caching pattern.
   
   ### Expected Behavior
   
   Cache a negative result only when its validity is determined by the cache 
key across the relevant candidate set. Do not reuse a miss across changes to 
headers, methods, query parameters, cookies or other dynamic matching inputs. A 
shorter TTL alone does not establish correctness.
   
   ### Steps To Reproduce
   
   1. Enable a test plugin with default match caches.
   2. Configure one enabled custom-flow selector A, continued=true, AND 
condition `header X-Tenant = a`.
   3. Add an enabled rule RA under A with `uri = /x`.
   4. Execute GET /x with X-Tenant=b. It does not match and creates a negative 
selector cache entry.
   5. Execute GET /x with X-Tenant=a. Observed: doExecute is still not called, 
even though the selector and rule match this request.
   6. Clear the selector match cache and repeat step 5: A/RA can execute.
   
   The first two-request failure was reproduced through the real execute path. 
The analogous rule negative-cache path was identified by source inspection. 
Default TTL is 60,000 ms; invalidation or eviction can end the incorrect reuse 
earlier.
   
   ### Anything else?
   
   - Empty selector caching: 
https://github.com/apache/shenyu/blob/862f5e37e894bd8cef85ef540a8629f313e9ecdf/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/AbstractShenyuPlugin.java#L290-L307
   - Empty rule caching: 
https://github.com/apache/shenyu/blob/862f5e37e894bd8cef85ef540a8629f313e9ecdf/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/AbstractShenyuPlugin.java#L309-L326
   - Eligibility checks: 
https://github.com/apache/shenyu/blob/862f5e37e894bd8cef85ef540a8629f313e9ecdf/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/AbstractShenyuPlugin.java#L157-L197
   - Related #7651 adds bounded TTL; this report concerns incorrect cache 
eligibility even within that TTL.
   
   ### Environment
   
   ShenYu master, 2.7.2-SNAPSHOT, commit 
`862f5e37e894bd8cef85ef540a8629f313e9ecdf`, Java 17.
   
   ### Validation
   
   Reproduced with a minimal concrete AbstractShenyuPlugin subclass, real 
BaseDataCache/MatchDataCache, Spring MockServerWebExchange and 
execute(...).block(). The subclass records selector/rule IDs in doExecute. 
Match caches use the default enabled settings. The existing 90 targeted 
matching/cache/predicate tests passed; this does not exercise a deployed HTTP 
gateway.
   


-- 
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