Skip to content

Fixes warning with _update_tracking_callback at shutdown#4985

Open
dengyuchenkit wants to merge 2 commits intoisaac-sim:developfrom
dengyuchenkit:ydeng/fix_warning
Open

Fixes warning with _update_tracking_callback at shutdown#4985
dengyuchenkit wants to merge 2 commits intoisaac-sim:developfrom
dengyuchenkit:ydeng/fix_warning

Conversation

@dengyuchenkit
Copy link

Description

Fixes warning with _update_tracking_callback at shutdown

Checklist

  • [x ] I have read and understood the contribution guidelines
  • [ x] I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Mar 12, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 12, 2026

Greptile Summary

This PR fixes a shutdown warning in ViewportCameraController._update_tracking_callback by wrapping the asset-tracking update calls in a try/except AttributeError block. During Python interpreter shutdown, module-level globals (e.g. wp, torch) and object attributes on scene assets can be set to None or deleted before the camera controller's __del__ unsubscribes the callback, causing AttributeError on every remaining rendering tick. The fix is targeted and correct for the described scenario.

Key points:

  • The root cause is a well-known Python shutdown ordering issue: the omni.kit post-update event stream may fire the callback after internal scene/asset data structures have begun teardown.
  • The existing __del__ method already unsubscribes the callback, but the unsubscribe may race with pending callback invocations during shutdown.
  • The catch is limited to AttributeError, which is appropriate for the described failure mode.
  • The only concern is that the exception is swallowed completely (pass), which could mask real AttributeError bugs introduced in the future. Adding a debug/verbose log (e.g. carb.log_verbose) would preserve discoverability without restoring the warning.

Confidence Score: 4/5

  • Safe to merge — the fix correctly addresses the shutdown warning with minimal risk to normal operation.
  • The change is a small, isolated guard in a rendering callback. It does not affect any data path, physics logic, or environment reset. The only risk is that a broad silent AttributeError catch could hide future regressions, but this is a low-probability concern in a UI/camera helper class.
  • No files require special attention — only one file is modified and the change is confined to 5 lines in a private callback method.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/envs/ui/viewport_camera_controller.py Wraps the camera-tracking update logic in a try/except AttributeError to prevent shutdown-time warnings when asset views are invalidated; the catch is broad and silently swallows all AttributeErrors, which could hide real bugs introduced in the future.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[omni.kit post-update event] --> B[lambda: obj._update_tracking_callback]
    B --> C{weakref alive?}
    C -- No --> D[ReferenceError\npropagates to omni.kit]
    C -- Yes --> E[_update_tracking_callback]
    E --> F{try block}
    F --> G{origin_type == asset_root?}
    G -- Yes --> H[update_view_to_asset_root]
    G -- No --> I{origin_type == asset_body?}
    I -- Yes --> J[update_view_to_asset_body]
    I -- No --> K[no-op]
    H --> L{AttributeError?}
    J --> L
    L -- Normal operation --> M[Camera view updated]
    L -- Shutdown: attrs invalidated --> N[except AttributeError: pass\nsilently skip]
Loading

Last reviewed commit: 4430a46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant