Skip to content

Leak TechAndDesign in Main.cc using absl::NoDestructor#10297

Merged
maliberty merged 6 commits into
The-OpenROAD-Project:masterfrom
calewis:leak-tech-and-design
May 20, 2026
Merged

Leak TechAndDesign in Main.cc using absl::NoDestructor#10297
maliberty merged 6 commits into
The-OpenROAD-Project:masterfrom
calewis:leak-tech-and-design

Conversation

@calewis
Copy link
Copy Markdown
Collaborator

@calewis calewis commented Apr 29, 2026

Running into static destruction order fiasco issues with the destructor of TechAndDesign in Main.cc. Just leak it to avoid this issue.

Signed-off-by: Drew Lewis <cannada@google.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces absl::NoDestructor for the static TechAndDesign object in src/Main.cc to prevent static destruction order issues. The changes include adding the Abseil dependency to the build configuration and updating the object's usage throughout the file to use pointer-like access. A review comment correctly points out that existing documentation in the file regarding destruction order is now misleading and should be updated to reflect that the object is now intentionally leaked.

Comment thread src/Main.cc
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Comment thread src/Main.cc
calewis added 2 commits April 29, 2026 18:50
Signed-off-by: Drew Lewis <cannada@google.com>
Signed-off-by: Drew Lewis <cannada@google.com>
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@maliberty
Copy link
Copy Markdown
Member

The tests failing here are passing in master.

Signed-off-by: Drew Lewis <cannada@google.com>
@calewis
Copy link
Copy Markdown
Collaborator Author

calewis commented May 4, 2026

@maliberty the failures seem pretty unrelated to any changes in this PR.

> ERROR: /tmp/workspace/OpenROAD-Public_PR-10297-head-3-bazel-ci/test/orfs/ram_8x7/BUILD:10:10: output 'test/orfs/ram_8x7/logs/asap7/ram_8x7/base/2_4_floorplan_pdn.json' was not created

Any insight?

Okay they indeed don't fail on master, I'm investigating.

When Tech and Design were leaked to avoid static destruction order issues, the Logger destructor was no longer called, preventing metrics files from being written. This commit registers a Tcl exit handler to finalize metrics and switches from exit() to Tcl_Exit() to ensure handlers are called.

Signed-off-by: Drew Lewis <cannada@google.com>
@maliberty
Copy link
Copy Markdown
Member

It isn't obvious how your change affects this result but it does seem to be consistent and not a random failure.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Comment thread src/OpenRoad.cc
Added tclDecls.h to provide Tcl_CreateExitHandler.

TAG=agy

CONV=79f113c7-30ba-4c57-9f8d-63ed49e63636

Signed-off-by: Drew Lewis <cannada@google.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

clang-tidy review says "All clean, LGTM! 👍"

@maliberty maliberty merged commit dc64608 into The-OpenROAD-Project:master May 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants