Skip to content

Conversation

@dashevchenko
Copy link
Contributor

@dashevchenko dashevchenko commented Dec 9, 2025

Pull Request description

Closing device sessions after tenant deletion

General checklist

  • You have reviewed the guidelines document.
  • Labels that classify your pull request have been added.
  • The milestone is specified and corresponds to fix version.
  • Description references specific issue.
  • Description contains human-readable scope of changes.
  • Description contains brief notes about what needs to be added to the documentation.
  • No merge conflicts, commented blocks of code, code formatting issues.
  • Changes are backward compatible or upgrade script is provided.
  • Similar PR is opened for PE version to simplify merge. Crosslinks between PRs added. Required for internal contributors only.

Front-End feature checklist

  • Screenshots with affected component(s) are added. The best option is to provide 2 screens: before and after changes;
  • If you change the widget or other API, ensure it is backward-compatible or upgrade script is present.
  • Ensure new API is documented here

Back-End feature checklist

  • Added corresponding unit and/or integration test(s). Provide written explanation in the PR description if you have failed to add tests.
  • If new dependency was added: the dependency tree is checked for conflicts.
  • If new service was added: the service is marked with corresponding @TbCoreComponent, @TbRuleEngineComponent, @TbTransportComponent, etc.
  • If new REST API was added: the RestClient.java was updated, issue for Python REST client is created.
  • If new yml property was added: make sure a description is added (above or near the property).

@dashevchenko dashevchenko added this to the 4.3 milestone Dec 9, 2025
@dashevchenko dashevchenko added enhancement Core Changes to Core labels Dec 9, 2025
@dashevchenko dashevchenko changed the title Closing device sessions after tenant deletion [Transport] Closing device sessions after tenant deletion Dec 10, 2025
@dashevchenko dashevchenko added Transport Changes to Transport Ignore for release Ignore this PR for release notes Bug and removed Core Changes to Core Ignore for release Ignore this PR for release notes enhancement labels Dec 10, 2025
if (sessionTenantId.equals(tenantId)) {
DeviceId sessionDeviceId = getDeviceId(md.getSessionInfo());
transportCallbackExecutor.submit(() -> {
md.getListener().onDeviceDeleted(sessionDeviceId);
Copy link
Member

Choose a reason for hiding this comment

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

Some handlers for onDeviceDeleted call checkLimits(...) which adds rate limits to rateLimitService cache.
Which was supposed to be cleaned by rateLimitService.remove(tenantId);

Copy link
Member

Choose a reason for hiding this comment

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

Don't you see it passes onDeviceDeleted to executor? What is the point of moving partly async onDevicesDeleted before the rateLimitService.remove(..)?

Copy link
Member

Choose a reason for hiding this comment

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

Also, moving the onDevicesDeleted before the cleanup of partition service - will cause some messages to be pushed to cores and rule engines

@ViacheslavKlimov
Copy link
Member

Please make sure that NO unnecessary calls to partition service, transport service, rate limit service, etc. are made when handling the tenant deletion and closing device sessions.

I would also like to see tests that verify that.

@dashevchenko dashevchenko changed the base branch from master to rc January 5, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Transport Changes to Transport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants