Skip to content

Limit deploying and undeploying channels to the requested IDs (fixes #456) - #567

Merged
tonygermano merged 1 commit into
OpenIntegrationEngine:mainfrom
iacsha:fix/456-channel-statistics-race
Nov 26, 2026
Merged

tonygermano merged 1 commit into
OpenIntegrationEngine:mainfrom
iacsha:fix/456-channel-statistics-race

Conversation

@iacsha

@iacsha iacsha commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #456.

Cause. DonkeyEngineController.getDashboardChannels(channelIds) filters donkey.getDeployedChannels() by the requested IDs, but then adds every channel in deployingChannels and undeployingChannels without that filter. So while channel B is mid-deploy or mid-undeploy, a request scoped to {A} also gets B. ChannelStatisticsServlet.getStatistics(channelId) returns channelStatisticsList.get(0), and when A is not deployed, B (a dashboard channel) is listed before undeployed A, so the response describes B. The same helper feeds getChannelStatusList, so per-channel dashboard status was affected too.

Fix. Apply the requested-ID filter to the deploying and undeploying sets as well. Unfiltered requests (no IDs) behave exactly as before, and a deployed channel still wins over a transitional entry with the same ID. The collection logic moved into a package-private static getDashboardChannels(deployed, deploying, undeploying, channelIds) so it can be unit tested without starting the engine; the instance method delegates to it.

Tests. New DonkeyEngineControllerDashboardChannelsTest (5 cases). With the filter removed, 3 of them fail; with the fix, all pass. Full :server:test passes (841 tests, 0 failures).

End-to-end repro (the issue's steps, on images built from main and from this branch, fresh appdata each): two VM-reader channels A and B, A left undeployed; one loop deploys B, sends a message, and undeploys B; three loops poll GET /api/channels/{A}/statistics for 90 seconds.

Build Deploy cycles Polls Responses describing B
main 539 6151 837
this branch 560 6404 0

With A deployed, main happened not to show it in my runs because HashMap order put A first, which is luck rather than correctness; the fix doesn't depend on ordering.

Release Note

Statistics and status requests for specific channels no longer include other channels

When a request asked for specific channels while another channel was being deployed or undeployed, the response could also include that other channel. This affected:

  • GET /channels/{channelId}/statistics, which returns the first channel in the list, so it could return the other channel's statistics instead of the requested one.
  • GET /channels/statistics and POST /channels/statistics/_getStatistics when given channel IDs, which could include an extra entry for the other channel.
  • GET /channels/statuses and POST /channels/statuses/_getChannelStatusList when given channel IDs, which could include an extra entry for the other channel. With an authorization plugin installed, that entry was not checked against the user's channel permissions.

Requests for all channels were not affected.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Test Results

  147 files  +1    147 suites  +1   4m 7s ⏱️ +2s
  996 tests +5    996 ✅ +5  0 💤 ±0  0 ❌ ±0 
1 314 runs  +5  1 308 ✅ +5  6 💤 ±0  0 ❌ ±0 

Results for commit da38caf. ± Comparison against base commit 89c8f99.

♻️ This comment has been updated with latest results.

@tonygermano tonygermano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Focused, correct fix for #456, and the tests and repro numbers make it easy to verify. Thank you!

Claude checked (no action needed): the new tests pass on this branch, and 3 of the 5 fail with the filter reverted, as the description says.


🤖 Drafted with Claude Code

…penIntegrationEngine#456)

getDashboardChannels filtered deployed channels by the requested channel IDs but added every deploying and undeploying channel unfiltered. A request for channel A made while channel B was mid-deploy or mid-undeploy therefore included B, and GET /channels/{A}/statistics, which returns the first entry, could describe B. Apply the same filter to the transitional sets. The collection logic moves into a package-private static helper so it can be unit tested.

Signed-off-by: iacsha <122627209+iacsha@users.noreply.github.com>
@tonygermano
tonygermano force-pushed the fix/456-channel-statistics-race branch from 28bf0f1 to da38caf Compare November 26, 2026 12:10
@tonygermano
tonygermano merged commit da38caf into OpenIntegrationEngine:main Nov 26, 2026
12 checks passed
@tonygermano tonygermano added this to the 4.8.0 milestone Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] GET /channels/{channelId}/statistics returns the counters of an unrelated channels

4 participants