Skip to content

Fix stale RX subscription cache after subscriber registration - #1243

Draft
gmartin82 wants to merge 2 commits into
eclipse-zenoh:mainfrom
ZettaScaleLabs:fix/rx-cache-stale-subscription-lookup
Draft

Fix stale RX subscription cache after subscriber registration#1243
gmartin82 wants to merge 2 commits into
eclipse-zenoh:mainfrom
ZettaScaleLabs:fix/rx-cache-stale-subscription-lookup

Conversation

@gmartin82

@gmartin82 gmartin82 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a stale RX-cache entry that could prevent newly registered subscribers from receiving matching samples.

What does this PR do?

  • Invalidates the subscription RX cache when registering a subscriber.
  • Adds a focused z_rx_cache_test regression that warms an empty subscription lookup, registers a subscriber, then verifies the next matching sample is delivered.
  • Enables Z_FEATURE_RX_CACHE in the existing Linux ASAN integration job with advanced pub/sub features enabled.

Why is this change needed?

With Z_FEATURE_RX_CACHE enabled, a sample received before any matching subscriber exists can cache an empty lookup result. Registering a subscriber did not invalidate that cache, so later samples on the same key could still be treated as having no subscribers. This caused z_api_advanced_pubsub_test to fail in advanced pub/sub history scenarios.

Related Issues

N/A


🏷️ Label-Based Checklist

Based on the labels applied to this PR, please complete these additional requirements:

Labels: bug

🐛 Bug Fix Requirements

Since this PR is labeled as a bug fix, please ensure:

  • Root cause documented - Explain what caused the bug in the PR description
  • Reproduction test added - Test that fails on main branch without the fix
  • Test passes with fix - The reproduction test passes with your changes
  • Regression prevention - Test will catch if this bug reoccurs in the future
  • Fix is minimal - Changes are focused only on fixing the bug
  • Related bugs checked - Verified no similar bugs exist in related code

Why this matters: Bugs without tests often reoccur.

Instructions:

  1. Check off items as you complete them (change - [ ] to - [x])
  2. The PR checklist CI will verify these are completed

This checklist updates automatically when labels change, but preserves your checked boxes.

@gmartin82 gmartin82 added the bug Something isn't working label Jun 11, 2026
@gmartin82
gmartin82 force-pushed the fix/rx-cache-stale-subscription-lookup branch from 9716456 to 0e25de2 Compare June 11, 2026 17:26
Comment thread tests/z_rx_cache_test.c Fixed
Comment thread tests/z_rx_cache_test.c Fixed

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cppcheck (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@gmartin82
gmartin82 force-pushed the fix/rx-cache-stale-subscription-lookup branch from 4782dba to 9ece051 Compare June 12, 2026 10:26
@gmartin82
gmartin82 force-pushed the fix/rx-cache-stale-subscription-lookup branch from 9ece051 to 45f0f54 Compare June 12, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants