lymerin opened a new pull request, #7447: URL: https://github.com/apache/shenyu/pull/7447
Fixes #7436 ### Problem and impact `AbstractDataChangedListener.updateCache()` stores the namespace-qualified cache key, such as `ns1_PLUGIN`, in `ConfigDataCache.group`. The recovery branch runs when the gateway reports a different MD5 and a newer modification timestamp than the polled admin's cached entry. This occurs when a gateway holds a newer snapshot while polling a lagging admin node. The branch applies `buildCacheKey()` to the already-qualified value, producing `ns1_ns1_PLUGIN`. This incorrect lookup causes an NPE before the namespace cache can be refreshed, or reads another namespace's entry when that key exists. The NPE has an additional operational consequence: the admin's global exception handler logs the stack trace and returns HTTP 200 with `data:null`. The gateway ignores the error code, returns normally for null data, exits the retry loop, and immediately starts another poll. Repeated failures therefore generate continuous requests and error stack traces against the affected admin. The ten-attempt retry and five-minute backoff described in the issue do not apply to this response path, because no exception reaches the gateway's retry handler. The loop can continue until another cache update path restores the entry, such as the periodic refresh whose default interval is five minutes. Existing recovery tests constructed cache entries with bare group names, unlike production, concealing the defect. ### Changes - Reuse `serverCache.getGroup()` as the complete cache key for all three recovery lookups: before locking, inside the lock, and after refreshing. - Document that `ConfigDataCache.group` contains the namespace-qualified cache key. - Align existing test fixtures with production cache entries. - Add regressions seeded through the real `updateCache()` method, covering all eight configuration groups, both post-refresh MD5 outcomes, concurrent cache replacement, namespace isolation, and the long-polling response. The existing cache representation and namespace locking remain in place. ### Validation - Ran `AbstractDataChangedListenerTest`, `ConfigDataCacheTest`, and `HttpLongPollingDataChangedListenerTest`: **55 tests passed, zero failures or errors**. - Checkstyle passed with zero violations. - Confirmed that the new production-seeded regression reproduces the NPE for all eight groups before the fix and passes after the fix. ### Checklist - [x] You have read the [[contribution guidelines](https://shenyu.apache.org/community/contributor-guide)](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [x] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`. -- 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]
