You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "89799969 (via GitHub)" <gi...@apache.org> on 2026/09/07 04:44:05 UTC
[I] [Studio][Bug] Paged data-source cache conflates null with literal filter values [rocketmq-dashboard]
89799969 opened a new issue, #4048:
URL: https://github.com/apache/rocketmq-dashboard/issues/4048
### Describe the bug
The paged data-source inventory builds its Spring cache key by concatenating nullable filter values:
```java
"'page:' + #search + ':' + #type + ':' + #page + ':' + #pageSize"
```
SpEL string concatenation renders a Java `null` as the literal text `null`. Therefore these distinct requests share the same cache key:
- no search filter: `search == null`
- a real search for the text `null`: `search.equals("null")`
After the unfiltered request is cached, the literal search can receive the unfiltered page without invoking the repository. Delimiter-containing values can create similar tuple collisions.
### Steps to reproduce
1. Enable the application's Spring cache configuration.
2. Stub `findDataSources(null, null, 1, 20)` and `findDataSources("null", null, 1, 20)` with different pages.
3. Call the two service methods in that order.
4. The second call returns the first page and the second repository stub is never invoked.
I reproduced this on current `rocketmq-studio` (`36126024`) with a focused Spring caching test; it fails before any production change.
### Expected behavior
Every distinct `(search, type, page, pageSize)` tuple has a distinct cache entry, including `null` versus literal text.
### Proposed fix
Use Spring's default multi-argument `SimpleKey` for the paged method instead of serializing arguments into a delimiter-based string, and add the failing regression test.
I'd like to work on this focused fix.
--
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: commits-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Studio][Bug] Paged data-source cache conflates null with literal filter values [rocketmq-dashboard]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #4048:
URL: https://github.com/apache/rocketmq-dashboard/issues/4048#issuecomment-5565318004
**Issue Evaluation**
Category: `bug` | Status: **Confirmed**
The reported issue has been verified against the current codebase on the `rocketmq-studio` branch.
**Root Cause:** The `@Cacheable` key expression at `SettingsService.java:221` uses SpEL string concatenation (`'page:' + #search + ':' + #type + ':' + #page + ':' + #pageSize`). SpEL renders Java `null` as the literal text `"null"`, so `search == null` and `search == "null"` produce the identical cache key `page:null:null:1:20`.
**Affected Code:** `server/src/main/java/org/apache/rocketmq/studio/settings/SettingsService.java:221`. Caching is enabled via `@EnableCaching` in `StudioApplication.java:27`; no custom `KeyGenerator` or cache configuration overrides exist.
**Impact:** Incorrect cached page returned when a literal `"null"` search is made after an unfiltered request (or vice versa).
**Severity:** Low — the collision only occurs for the literal string `"null"`.
**Proposed Fix:** Remove the explicit `key` attribute and rely on Spring's default `SimpleKeyGenerator`, which correctly distinguishes `null` from `"null"` across method arguments. A regression test covering both cases should be added.
An automated fix proposal can be generated. Reply with:
- `/approve` — proceed with PR generation
- `/revise` — request a different approach
- `/reject` — decline automated fix
---
*Automated evaluation by RockteMQ-AI*
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Studio][Bug] Paged data-source cache conflates null with literal filter values [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on issue #4048:
URL: https://github.com/apache/rocketmq-dashboard/issues/4048#issuecomment-5602328736
Resolved by #4049 (merged into `rocketmq-studio` as c6b546a7).
The diagnosis in this issue was exact: the SpEL key `'page:' + #search + ':' + #type + ':' + #page + ':' + #pageSize` renders a null `String` as the literal text `null`, so `(null, null, 1, 20)` and `("null", null, 1, 20)` hashed to the same `data-sources` entry and the second caller was served the first caller's page. The fix drops the explicit key so Spring's `SimpleKeyGenerator` is used; `SimpleKey` keeps the arguments and compares with `Arrays.deepEquals`, so null and the four-character string `null` are distinct keys.
`SettingsServiceCachingTest.pagedInventoryShouldDistinguishNullFromLiteralNullSearchTest` pins it through a real caching proxy (`@ContextConfiguration` over a nested `@EnableCaching` config, `SettingsService` autowired rather than constructed), asserting both that the two calls return their own objects and that the repository is hit once for each argument shape. We confirmed the test is sensitive to the fix by restoring the old SpEL key and watching it fail.
The no-argument `listDataSources()` shares the cache name but resolves to `SimpleKey.EMPTY`, which cannot collide with a four-element `SimpleKey`, and the three `@CacheEvict(allEntries = true)` sites do not depend on the key, so invalidation is unchanged.
GitHub did not auto-close this from the `Fixes` reference because the merge target is `rocketmq-studio` rather than the repository default branch.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Studio][Bug] Paged data-source cache conflates null with literal filter values [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed issue #4048: [Studio][Bug] Paged data-source cache conflates null with literal filter values
URL: https://github.com/apache/rocketmq-dashboard/issues/4048
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org