Skip to content

jazzy, lyrical, rolling: fix class_loader exit abort (console_bridge static order) - #243

Open
Tobias-Fischer wants to merge 1 commit into
mainfrom
class-loader-exit-order
Open

Tobias-Fischer wants to merge 1 commit into
mainfrom
class-loader-exit-order

Conversation

@Tobias-Fischer

Copy link
Copy Markdown
Collaborator

On macOS, processes that still hold `ClassLoader`s at exit abort, for example `rqt --list-plugins` and closing rqt: `mutex lock failed`, then `std::terminate` and exit code 134.

Cause: class_loader's static `ClassLoaderPtrVectorImpl` destroys the remaining loaders at exit. `~ClassLoader()` logs through console_bridge, whose output handler (a function-local static) has already been destroyed by then. `ClassLoaderDependency()` already makes sure class_loader's own statics outlive `class_loader_ptrs_`. Calling `console_bridge::getLogLevel()` there does the same for console_bridge's.

Fix: the same one-line change as ros/class_loader#252, as `patch/ros2-class-loader.patch` with build-number bumps:

distro class_loader build number
jazzy 2.7.1 32 (new patch)
lyrical 2.9.4 31
rolling 3.0.2 33
  • humble: class_loader 2.2.0 has no `ClassLoaderDependency` and doesn't abort, so it's unchanged.
  • lyrical and rolling: their previous `ros2-class-loader.patch` only made `getAvailableClassesForLibrary`'s `loader` const. Upstream already has that in 2.9.4 and 3.0.2; on rolling, the old hunk applied with an offset to a different line. It's replaced by this fix.

Tested on osx-arm64: built all three. `rqt --list-plugins`, run offscreen, exits with 134 using the published class_loader and 0 with the patched one, on lyrical and rolling. Jazzy was checked the same way earlier.

🤖 Generated with Claude Code

…l exit

On exit, class_loader's static ClassLoaderPtrVectorImpl destroys the still-held
ClassLoaders, and ~ClassLoader() logs through console_bridge, whose output handler (a
function-local static) can already be gone: "mutex lock failed", std::terminate, exit 134
(e.g. `rqt --list-plugins` on macOS). ClassLoaderDependency() already orders class_loader's
own statics before class_loader_ptrs_; console_bridge::getLogLevel() there does the same for
console_bridge's. Same change as ros/class_loader#252. humble's class_loader 2.2.0 has no
ClassLoaderDependency and doesn't abort.

lyrical/rolling: the previous patch only made getAvailableClassesForLibrary's loader const,
which upstream already has in 2.9.4/3.0.2 (on rolling it applied with an offset to another
occurrence); it is replaced by this fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ABI check (linux-64)

jazzy linux-64: 2 can be bumped on their own
2 packages can be bumped on their own (compatible: 2)
package released → PR verdict details
class-loader 2.7.1 (build 31) → 2.7.1 compatible: no ABI change headers unchanged
rmf-utils 1.6.2 (build 31) → 1.6.2 compatible: no ABI change headers unchanged

Compared with the newest builds on https://conda.anaconda.org/robostack-jazzy/linux-64.

lyrical linux-64: **1 need their dependents rebuilt**, 6 can be bumped on their own
package released → PR verdict details
rmf-fleet-adapter-python 2.13.0 (build 30) → 2.13.0 soname: SONAME changed: rebuild the dependents libraries: rmf_adapter.cpython-314-x86_64-linux-gnu.so (soname)
rebuild 0 dependents (of 1 released dependents, these link to it): none
6 packages can be bumped on their own (compatible: 6)
package released → PR verdict details
class-loader 2.9.4 (build 30) → 2.9.4 compatible: no ABI change headers unchanged
rmf-fleet-adapter 2.13.0 (build 30) → 2.13.0 compatible: no ABI change headers unchanged
rmf-task-ros2 2.13.0 (build 30) → 2.13.0 compatible: no ABI change headers unchanged
rmf-traffic-ros2 2.13.0 (build 30) → 2.13.0 compatible: no ABI change headers unchanged
rmf-utils 1.8.1 (build 30) → 1.8.1 compatible: no ABI change headers unchanged
rmf-websocket 2.13.0 (build 30) → 2.13.0 compatible: no ABI change headers unchanged

Compared with the newest builds on https://repo.prefix.dev/robostack-lyrical/linux-64.

rolling linux-64: **1 need their dependents rebuilt**, 1 to review (changed headers), 5 can be bumped on their own
package released → PR verdict details
rmf-fleet-adapter-python 2.12.0 (build 32) → 2.12.0 soname: SONAME changed: rebuild the dependents libraries: rmf_adapter.cpython-314-x86_64-linux-gnu.so (soname)
rebuild 0 dependents (of 1 released dependents, these link to it): none
class-loader 3.0.2 (build 32) → 3.0.2 compatible: no ABI change 1 headers changed (check for layout/inline changes): class_loader/class_loader/multi_library_class_loader.hpp
5 packages can be bumped on their own (compatible: 5)
package released → PR verdict details
rmf-fleet-adapter 2.12.0 (build 32) → 2.12.0 compatible: no ABI change headers unchanged
rmf-task-ros2 2.12.0 (build 32) → 2.12.0 compatible: no ABI change headers unchanged
rmf-traffic-ros2 2.12.0 (build 32) → 2.12.0 compatible: no ABI change headers unchanged
rmf-utils 1.7.0 (build 32) → 1.7.0 compatible: no ABI change headers unchanged
rmf-websocket 2.12.0 (build 32) → 2.12.0 compatible: no ABI change headers unchanged

Compared with the newest builds on https://repo.prefix.dev/robostack-rolling/linux-64.

About this check

Each package this pull request built, compared with its newest released build (tools/abi_check.py, libabigail):

  • compatible / additions: the package can be bumped on its own;
  • soname / incompatible: the packages that depend on it need a rebuild (build number bump) in the same pull request.

Exported symbols are compared (the released packages are stripped, so struct layouts aren't); unchanged installed headers rule out layout and inline changes, changed ones are listed for review. Dependents to rebuild are the released ones linking to a changed library. A changed pin is part of the comparison.

@traversaro traversaro 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.

Good to go for me, but those are the classical issues that it is quite easy to regress on. If the agent could find a test that captures this problem so we make sure we do not regress, it would be great.

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.

2 participants