Repository navigation
MOD-16600 Bump LibMR to master: fix the mr.c:939 assertion on 8.8 - #2139
Conversation
deps/LibMR a37b672 -> c6a5ed62, and pass topologyEvents=false at the MR_Init call site. Why: the assertion LibMR RedisTimeSeries#116 fixes is still reproducing on the RE8.8 nightly. Build 100.0.20-7660 (2026-08-05), released TS 80802, shard redis-119: 21:22:23.033 <timeseries> cluster topology changed (x5 in 4ms) 21:22:23.037 <timeseries> Got cluster set command (long form) 21:22:23.037 === REDIS BUG REPORT START 21:22:23.037 # ==> /workspace/deps/LibMR/src/mr.c:939 'false' is not true Long-form CLUSTERSET -> MR_SetClusterData -> MR_ClusterFree() transiently reports a one-shard topology -> a concurrent execution takes ExecutionFlag_Local -> its StepType_InternalCommand reaches the worker path -> assert. RedisTimeSeries#116 holds the Redis lock across the free/rebuild so that state is never observable. It landed on LibMR master 2026-07-26; 8.8 pinned a37b672, which predates it, so MOD-16600 could not be verified on that lane at all. Why bump to master rather than backport: MR_Init is the only LibMR API that changed between the two pins. Of the 39 MR_* symbols this branch references, 32 are declared in LibMR headers and MR_Init is the single one whose declaration differs; nothing was removed. So one argument at the call site is the whole compatibility cost, which is cheaper than a maintenance branch plus a cherry-pick per fix. topologyEvents=false is correct here, not merely conservative: redis on this line never emits the topology-change notification -- the Enterprise cluster plugin reports "Failed to load symbol: clusterNotifyTopologyChanged, assuming this an old redis version w/out ASM" -- so those paths are unreachable, and MR_ClusterInit's entire diff between the pins is `clusterCtx.topologyEvents = topologyEvents;`, i.e. false reproduces the old behaviour exactly. Also arriving with this bump: - RedisTimeSeries#104 skip the rebuild when CLUSTERSET carries an unchanged topology (MOD-16399) - RedisTimeSeries#108 fix the execution leak when an initiator execution is aborted - RedisTimeSeries#111/RedisTimeSeries#115 gate inter-shard TLS on tls-cluster for native-cluster-view paths (MOD-16951). Long-form CLUSTERSET keeps the historical tls-port fallback, and this branch shows the symptom they fix -- 97 "execution max idle reached" on redis-119 in the 7660 package. - RedisTimeSeries#117/RedisTimeSeries#119 topology-event adjustments, inert with the flag off. Verified: builds clean for linux-arm64 in rockylinux:9 + gcc-toolset-13 (the toolchain behind the shipped rhel9-arm64 artifact). Flow suite not run locally -- leaving that to CI.
|
|
Two corrections and one follow-up on this bump, from a per-commit audit of everything 8.8 inherited. 1. The TLS claim in the PR body is wrong. I wrote that #111/#115 "keep the historical tls-port fallback" for long-form CLUSTERSET. They do not. // a37b672
if (!clusterTls || strcmp(clusterTls,"yes")) { tlsPort = getConfigValue(...,"tls-port");
if (!tlsPort || !strcmp(tlsPort,"0")) { ret=0; goto done; } }
// c6a5ed62 (src/cluster.c:548-558)
bool clusterTlsEnabled = clusterTls && !strcmp(clusterTls,"yes");
if (!clusterTlsEnabled) { ret = 0; goto done; }i.e. inter-shard TLS is now strictly Unreachable in RE steady state — CNM writes 2. 8.8 is now exposed to a fail-open → fail-closed change on short-form CLUSTERSET that I did not flag.
3. Also inherited, worth knowing: None of this argues the bump was wrong — 8.8 is the only line where the |
deps/LibMR a37b672 -> c6a5ed62, pass topologyEvents=false at MR_Init (src/libmr_integration.c:795), and read INFOCLUSTER's status positionally from the end instead of index 17. The mr.c:939 assertion that motivated the 8.8 bump (#2139) cannot fire on this line -- there are no MR_ExecutionBuilderInternalCommand call sites here, so no execution contains a StepType_InternalCommand step. What this line does have is the silent half of the same race: MR_ClusterFree sets clusterCtx.clusterSize = 1 while MR_CreateExecution reads it on the main thread, and an execution wrongly flagged ExecutionFlag_Local skips the cross-shard collect, so TS.MRANGE / TS.MGET / TS.QUERYINDEX answer from the local shard with no error. #116 closes that by holding the Redis lock across the free/rebuild. Taking master rather than cherry-picking #116 alone also brings #104 (MOD-16399, skip the rebuild for an unchanged CLUSTERSET), #108 (execution leak on an aborted initiator execution), #111+#115 (MOD-16951, inter-shard TLS), and the #117 INFOCLUSTER fix that removes a live assert here (a37b672 src/cluster.c:1530, RedisModule_Assert(n->slotRanges->len == 1), trippable by a multi-range or slotless master). topologyEvents=false is correct rather than merely conservative: redis on this line never emits the topology-change notification, and MR_ClusterInit's whole diff between the two pins is 'clusterCtx.topologyEvents = topologyEvents;'. MR_TopologyEventSeen has exactly one setter, MR_UpdateClusterTopology(), which no release branch calls, so the gated branches are provably inert. The test change is required by #117, which turns INFOCLUSTER's per-node reply from a fixed 18 elements into 14 + 4*ranges. status is the last element in both layouts, so n[-1] is correct before and after the bump; n[17] silently reads a slot-range value once a node has more than one range and hangs verifyClusterInitialized. Two behaviour changes worth naming in the release notes: - Inter-shard TLS now requires tls-cluster=yes. #115 deletes #111's long-form carve-out, so the tls-port fallback is gone for every topology form. - Short-form CLUSTERSET is now fail-closed: MR_BuildCluster rejects a topology with a duplicate slot claim or coverage != 16384 instead of installing a degraded one. Rejection leaves the shard answering locally until the next successful CLUSTERSET, so watch for 'rejecting topology' in shard logs. Verified: builds clean for linux-arm64 in rockylinux:9 + gcc-toolset-13. Flow suite left to CI.
deps/LibMR a37b672 -> c6a5ed62, pass topologyEvents=false at MR_Init (src/libmr_integration.c:796), and read INFOCLUSTER's status positionally from the end instead of index 17. The mr.c:939 assertion that motivated the 8.8 bump (#2139) cannot fire on this line -- there are no MR_ExecutionBuilderInternalCommand call sites here, so no execution contains a StepType_InternalCommand step. What this line does have is the silent half of the same race: MR_ClusterFree sets clusterCtx.clusterSize = 1 while MR_CreateExecution reads it on the main thread, and an execution wrongly flagged ExecutionFlag_Local skips the cross-shard collect, so TS.MRANGE / TS.MGET / TS.QUERYINDEX answer from the local shard with no error. #116 closes that by holding the Redis lock across the free/rebuild. Taking master rather than cherry-picking #116 alone also brings #104 (MOD-16399, skip the rebuild for an unchanged CLUSTERSET), #108 (execution leak on an aborted initiator execution), #111+#115 (MOD-16951, inter-shard TLS), and the #117 INFOCLUSTER fix that removes a live assert here (a37b672 src/cluster.c:1530, RedisModule_Assert(n->slotRanges->len == 1), trippable by a multi-range or slotless master). topologyEvents=false is correct rather than merely conservative: redis on this line never emits the topology-change notification, and MR_ClusterInit's whole diff between the two pins is 'clusterCtx.topologyEvents = topologyEvents;'. MR_TopologyEventSeen has exactly one setter, MR_UpdateClusterTopology(), which no release branch calls, so the gated branches are provably inert. The test change is required by #117, which turns INFOCLUSTER's per-node reply from a fixed 18 elements into 14 + 4*ranges. status is the last element in both layouts, so n[-1] is correct before and after the bump; n[17] silently reads a slot-range value once a node has more than one range and hangs verifyClusterInitialized. Two behaviour changes worth naming in the release notes: - Inter-shard TLS now requires tls-cluster=yes. #115 deletes #111's long-form carve-out, so the tls-port fallback is gone for every topology form. - Short-form CLUSTERSET is now fail-closed: MR_BuildCluster rejects a topology with a duplicate slot claim or coverage != 16384 instead of installing a degraded one. Rejection leaves the shard answering locally until the next successful CLUSTERSET, so watch for 'rejecting topology' in shard logs. Verified: builds clean for linux-arm64 in rockylinux:9 + gcc-toolset-13. Flow suite left to CI.



What
deps/LibMRa37b672→c6a5ed62(master), plustopologyEvents=falseat theMR_Initcall site — two lines total.Why
The assertion LibMR #116 fixes is still reproducing on the RE8.8 nightly, because this branch has never carried #116. Build
100.0.20-7660(2026-08-05), released TS80802, shardredis-119:Long-form
CLUSTERSET→MR_SetClusterData→MR_ClusterFree()transiently reports a one-shard topology → a concurrent execution takesExecutionFlag_Local→ itsStepType_InternalCommandreaches the worker path → assert. #116 holds the Redis lock across the free/rebuild so that state is never observable. It landed on LibMR master on 2026-07-26;a37b672predates it.Consequence today: MOD-16600 sits in verification against a lane that structurally cannot verify it. Liran has re-reported it on essentially every nightly.
Why bump to master instead of backporting
MR_Initis the only LibMR API that changed between the two pins. Of the 39MR_*symbols this branch references, 32 are declared in LibMR headers, andMR_Initis the single one whose declaration differs — nothing was removed:So one extra argument is the entire compatibility cost — cheaper than a LibMR maintenance branch plus a cherry-pick for every future fix. (I opened both alternatives as RedisGears/LibMR#120 and #121 and closed them in favour of this.)
Why
topologyEvents=falseis correct, not just conservativeRedis on this line never emits the topology-change notification — the Enterprise cluster plugin says so at startup:
So the topology-event paths are unreachable here, not merely disabled. And
MR_ClusterInit's entire diff between the two pins isclusterCtx.topologyEvents = topologyEvents;— no conditional registration, no behaviour branch — sofalsereproducesa37b672's behaviour exactly.What else arrives with the bump
tls-clusterfor native-cluster-view paths (MOD-16951)execution max idle reachedonredis-119in the 7660 packageVerification
linux-arm64inrockylinux:9+gcc-toolset-13— the toolchain behind the shipped rhel9-arm64 artifact. Module links.too few arguments to function call, expected 4, have 3, confirming the one-liner is both necessary and sufficient.Not fixed by this
MOD-16600's scenario has a second defect that this does not touch: the MOD-15896 Enterprise/OSS misdetection. The same 7660 packages show
Detected redis oss (cluster-enabled=yes)on the ASM shards (×14 / ×24, versus ×180 correctenterprise (cluster-enabled=no)on non-cluster DBs), producing 1309 rejectedtimeseries.HELLO, 722message was not sent because status is not connected, and 97execution max idle reachedon one shard. So expect the crash to stop and the scale-under-traffic scenario to possibly still fail until that is fixed separately.8.6 / 8.4 pin the same
a37b672and can take the identical two-line change if wanted.Note
Medium Risk
Touches cluster coordination and inter-shard execution (LibMR) at module init and during CLUSTERSET; wrong topologyEvents or regressions in the bump could affect MRANGE/MGET across shards, though
falseis chosen to preserve legacy behavior on 8.8.Overview
Fixes MOD-16600 by moving
deps/LibMRto current master so LibMR #116 is included: cluster topology rebuild during long-formCLUSTERSETno longer exposes a transient one-shard view that could trip themr.c:939assert on concurrent internal-command execution.The only Timeseries call-site change is in
register_mr:MR_Initnow takes a fourth argument,false, because this Redis line does not emit topology-change notifications (ASM/clusterNotifyTopologyChangedis absent). That matches prior behavior on the old pin and keeps topology-event paths inactive.The bump also pulls in unrelated LibMR fixes on this branch (e.g. skip redundant CLUSTERSET rebuild, execution leak fix, inter-shard TLS gating). A separate Enterprise/OSS cluster misdetection issue noted in MOD-16600 is not addressed here.
Reviewed by Cursor Bugbot for commit f0b9319. Bugbot is set up for automated code reviews on this repo. Configure here.