Enhance error handling and resync logic in stream module - #77
Conversation
- add requestResync call on Lua script execution errors - log resync failures with detailed messages - ensure resyncInFlight is reset after completion - validate readable element bytes for collections and arrays
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33d7a2fdbe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fun <T, C : MutableCollection<T>> ByteBuf.readCollection(creator: (Int) -> C, reader: (ByteBuf) -> T): C { | ||
| val size = readVarInt() | ||
| checkContainerSize("Collection", size) | ||
| checkReadableElementBytes("Collection", size) |
There was a problem hiding this comment.
Allow zero-byte elements in generic container readers
When a caller uses a valid zero-byte element encoding, such as writeCollection(listOf(Unit)) { _, _ -> } paired with a reader that returns Unit without consuming bytes, this new guard rejects the payload because only the length prefix remains readable. The public writer and reader callbacks do not require each element to occupy a byte, so the same assumption added to generic arrays and maps also breaks previously supported codecs; avoid applying a fixed per-element byte lower bound to these callback-based readers.
Useful? React with 👍 / 👎.
| val redisURI = details.redisURI | ||
|
|
||
| val config = Config() | ||
| .setUsername(redisURI.username) |
There was a problem hiding this comment.
Treat an empty URI username as absent
When a caller supplies the conventional password-only form redis://:secret@host, RedisURI.username represents the empty user-info component rather than an absent username. Passing that value directly to Redisson makes authentication use the username/password form with an empty ACL username, so a server expecting password authentication for the default user rejects the connection; normalize a blank username to null before setting it.
Useful? React with 👍 / 👎.
This pull request includes a version bump and several improvements and fixes across the Redis API and core modules. The most important changes address container deserialization safety, diagnostics for custom event publishing, cache refresh logic, error handling in sync structures, and improved handling of empty remote data.
Serialization and Deserialization Safety:
checkReadableElementBytes) to all container deserialization methods inbyte-buf-extensions.ktto prevent malformed payloads from causing oversized allocations, improving security and robustness. [1] [2] [3] [4] [5] [6]Diagnostics and Logging:
RedisEventBusImpl, including limiting repeated logs and providing detailed information when events are published on binary channels or when decoding fails. [1] [2] [3] [4]Cache and Data Consistency Improvements:
SimpleRedisCacheImplrefresh gate expiration to scale with TTL, ensuring more efficient cache refreshes.SimpleSetRedisCacheImplto invalidate and re-fetch cache entries from Redis when a value is missing locally but present in Redis, reducing stale cache issues.Sync Structure Robustness:
AbstractStreamSyncStructureby triggering resyncs on Lua script errors and logging failures during resync, ensuring better recovery from remote errors. [1] [2] [3]SyncListImpl,SyncMapImpl, andSyncSetImplto default to empty collections if remote data is missing, preventing null-related issues. [1] [2] [3]Other Notable Changes:
1.10.2ingradle.properties.ignoreUnknownKeys = truefor JSON serialization to improve compatibility with evolving data schemas.These changes collectively improve the reliability, safety, and maintainability of the Redis API and its core components.