Skip to content

Rdkemw 17528 02#947

Merged
kvfasil merged 13 commits into
3.3.rcfrom
RDKEMW-17528-02
Apr 29, 2026
Merged

Rdkemw 17528 02#947
kvfasil merged 13 commits into
3.3.rcfrom
RDKEMW-17528-02

Conversation

@kvfasil
Copy link
Copy Markdown
Contributor

@kvfasil kvfasil commented Apr 28, 2026

What

What does this PR add or remove?

Why

Why are these changes needed?

How

How do these changes achieve the goal?

Test

How has this been tested? How can a reviewer test it?

Checklist

  • I have self-reviewed this PR
  • I have added tests that prove the feature works or the fix is effective

kvfasil added 5 commits April 27, 2026 11:33
…ebSocket disconnect

*Sessions were registered by connection_id but cleanup used session_id,causing remove_session() to be a no-op.
*Event listeners and empty map entries accumulated indefinitely across disconnects.

Changes:
- app_events.rs: Add cleanup_by_connection_id(), prune empty entries in remove_session()
- firebolt_gateway.rs: Clean up by both session_id and connection_id on UnregisterSession
- thunder_event_processor.rs: Add cleanup_by_app_id() for extension-side event map cleanup
- firebolt_ws.rs: Elevate disconnect log from debug! to info! with full context
…ventProcessor Subscription entries.

-In request_map and extension_request_map were never removed on disconnect.
-ThunderEventProcessor.cleanup_by_app_id() existed but was never called.
-Added DeviceEvent::Cleanup to wire ThunderEventProcessor cleanup across the gateway-extension boundary.
-Added cleanup_request_maps_for_app() to prune broker maps on disconnect.
Copilot AI review requested due to automatic review settings April 28, 2026 01:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds disconnect-time cleanup to reduce leaked listeners/subscriptions across Firebolt app events, broker request tracking, and Thunder device event handling.

Changes:

  • Add a DeviceEvent::Cleanup request that is sent on session disconnect to purge Thunder-side device event listeners for the disconnected app.
  • Improve in-process cleanup by pruning empty AppEvents listener maps and adding cleanup by connection_id.
  • Enhance broker cleanup by removing stale request tracking entries and improving Thunder broker unsubscribe/unregister behavior on disconnect.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
device/thunder_ripple_sdk/src/processors/thunder_events.rs Handles new DeviceEvent::Cleanup request in the Thunder extension processor.
device/thunder_ripple_sdk/src/events/thunder_event_processor.rs Adds cleanup_by_app_id plus unit tests for removing per-app listeners.
core/sdk/src/api/device/device_events.rs Introduces DeviceEvent::Cleanup, parsing, contract mapping, and tests.
core/main/src/service/apps/app_events.rs Prunes empty listener maps on session removal; adds cleanup by connection_id and tests.
core/main/src/firebolt/firebolt_ws.rs Logs richer disconnect information before unregistering the session.
core/main/src/firebolt/firebolt_gateway.rs Performs broader disconnect cleanup (events, broker, endpoint state) and triggers Thunder cleanup request.
core/main/src/broker/thunder_broker.rs Improves broker cleaner unsubscribe behavior and channel sizing; adds warnings/logging.
core/main/src/broker/endpoint_broker.rs Adds request/extension map cleanup on disconnect and unit tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread device/thunder_ripple_sdk/src/events/thunder_event_processor.rs
Comment thread core/main/src/firebolt/firebolt_gateway.rs
Comment thread core/main/src/firebolt/firebolt_gateway.rs
…load

Change try_send to send().await in BrokerCleaner::cleanup_session() to wait for
channel capacity instead of silently dropping cleanup messages when the channel
is full, which prevented Thunder .unregister calls from being sent.
Comment thread core/main/src/broker/endpoint_broker.rs Fixed
Comment thread core/main/src/firebolt/firebolt_gateway.rs Fixed
Comment thread core/main/src/firebolt/firebolt_ws.rs Fixed
ID in the forwarder loop and skip event_handler processing when payload
is unchanged. Adds 5 unit tests for the dedup logic.
Copilot AI review requested due to automatic review settings April 28, 2026 20:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/main/src/broker/endpoint_broker.rs Outdated
Comment thread core/main/src/broker/endpoint_broker.rs Outdated
Comment thread core/main/src/broker/endpoint_broker.rs Outdated
Comment thread device/thunder_ripple_sdk/src/processors/thunder_events.rs Outdated
Comment thread device/thunder_ripple_sdk/src/events/thunder_event_processor.rs Outdated
kvfasil added 2 commits April 28, 2026 18:14
Each call to jq_compile() created Rc reference cycles in jaq-interpret
that were never freed, leaking ~120 heap nodes (~24 KB) per event_handler
cycle.

fix:
Cache compiled Filter objects in a static HashMap so each unique filter
string is parsed and compiled only once. Subsequent calls clone the
cached filter (cheap Rc refcount increment) instead of recompiling.
Copilot AI review requested due to automatic review settings April 29, 2026 01:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/main/src/broker/rules/rules_engine.rs
Comment thread device/thunder_ripple_sdk/src/events/thunder_event_processor.rs
Comment thread core/main/src/firebolt/firebolt_ws.rs Outdated
Comment thread core/main/src/broker/endpoint_broker.rs Fixed
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 06:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/main/src/broker/endpoint_broker.rs
Comment thread core/main/src/broker/endpoint_broker.rs
Comment thread core/sdk/src/api/device/device_events.rs
Comment thread core/main/src/broker/endpoint_broker.rs Dismissed
- Rename cleanup_request_maps_for_app to cleanup_request_maps and
  parameter app_id to id to clarify it may be app_id, session_id,
  or connection_id
- Drop event_map write lock before acquiring last_event write lock
  in cleanup_by_app_id to prevent potential deadlocks
Comment thread core/main/src/broker/endpoint_broker.rs Fixed
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 08:17
@github-actions
Copy link
Copy Markdown

Code Coverage

Package Line Rate Health
core.main.src.bootstrap.extn 0%
core.main.src.state 36%
core.sdk.src.utils 58%
core.main.src.broker 69%
device.thunder_ripple_sdk.src.client 61%
core.main.src.firebolt 13%
core.sdk.src.api.manifest 74%
core.sdk.src.manifest 0%
core.sdk.src.api.firebolt 85%
core.main.src.utils 28%
core.sdk.src.api.gateway 69%
device.thunder_ripple_sdk.src.processors 19%
core.sdk.src.extn.client 81%
core.main.src 0%
core.main.src.broker.rules 78%
core.main.src.processor 0%
device.thunder_ripple_sdk.src 13%
core.sdk.src.processor 9%
device.thunder_ripple_sdk.src.bootstrap 0%
core.tdk.src.utils 0%
device.mock_device.src 56%
device.thunder_ripple_sdk.src.processors.events 0%
core.main.src.bootstrap 0%
core.main.src.state.cap 42%
core.main.src.broker.test 90%
core.sdk.src.api 44%
core.main.src.firebolt.handlers 12%
core.sdk.src.framework 64%
core.main.src.broker.thunder 37%
core.main.src.service.extn 25%
core.main.src.service.ripple_service 9%
core.main.src.bootstrap.manifest 0%
core.main.src.service 32%
core.sdk.src.service.mock_app_gw.appgw 0%
core.sdk.src.service.mock_app_gw 0%
core.sdk.src.service 65%
core.main.src.processor.storage 0%
core.tdk.src.gateway 100%
device.thunder_ripple_sdk.src.events 43%
core.sdk.src.api.distributor 29%
core.sdk.src.api.observability 57%
core.main.src.service.apps 31%
core.sdk.src.extn 76%
core.sdk.src.extn.ffi 0%
core.sdk.src.api.device 76%
Summary 50% (21891 / 44069)

Minimum allowed line rate is 48%

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/main/src/broker/endpoint_broker.rs
Comment thread core/main/src/broker/thunder_broker.rs
@kvfasil kvfasil merged commit 5933cf3 into 3.3.rc Apr 29, 2026
12 checks passed
@kvfasil kvfasil deleted the RDKEMW-17528-02 branch April 29, 2026 19:45
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants