Skip to content

Put ImR_Activator_ORB_Runner into its own file, use make_unique, fix C++23 warnings#2422

Merged
jwillemsen merged 6 commits into
DOCGroup:masterfrom
jwillemsen:jwi-imrorbrunner
Jul 9, 2025
Merged

Put ImR_Activator_ORB_Runner into its own file, use make_unique, fix C++23 warnings#2422
jwillemsen merged 6 commits into
DOCGroup:masterfrom
jwillemsen:jwi-imrorbrunner

Conversation

@jwillemsen
Copy link
Copy Markdown
Member

@jwillemsen jwillemsen commented Jul 9, 2025

Summary by CodeRabbit

  • New Features
    • Introduced a new background service runner to improve service management.
  • Refactor
    • Updated internal components to use modern C++ practices and clearer structure.
    • Improved class declarations with explicit overrides and defaulted special member functions.
    • Streamlined example service classes with updated constructors and destructors.
    • Enhanced method declarations with override specifiers for clarity.
  • Chores
    • Adjusted build configuration to include new service runner functionality.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 9, 2025

Walkthrough

A new class, ImR_Activator_ORB_Runner, is introduced and split into its own header and source files. The loader class's constructor and destructor are updated, and modern C++ practices are adopted for memory management. The build configuration is modified to include the new source file. Minor cleanup and override specifiers are added to example service classes and test headers. No logic changes to service initialization or control flow are made.

Changes

File(s) Change Summary
TAO/orbsvcs/ImplRepo_Service/Activator_Loader.cpp, .h Removes local class definition; uses new header; adds destructor; updates constructor and overrides; modernizes smart pointer usage and formatting.
TAO/orbsvcs/ImplRepo_Service/Activator_ORB_Runner.cpp, .h Adds new class ImR_Activator_ORB_Runner in dedicated files with constructor, destructor, and svc() method.
TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc Adds Activator_ORB_Runner.cpp to the build configuration.
TAO/orbsvcs/examples/ImR/Combined_Service/dynserver.cpp, .h Removes explicit constructors/destructors; changes constructor to destructor in loader; adds override specifiers and defaulted special members.
TAO/tests/MT_NoUpcall_Client_Leader/chatter.h Changes svc() method to use override specifier; removes volatile qualifier from member variables.
ACE/tests/Mem_Map_Test.cpp Changes constants to constexpr; removes volatile qualifier from loop variable; deletes obsolete comment.

Sequence Diagram(s)

sequenceDiagram
    participant Main
    participant Loader as ImR_Activator_Loader
    participant Runner as ImR_Activator_ORB_Runner

    Main->>Loader: init()
    Loader->>Runner: create (std::make_unique)
    Main->>Runner: svc()
    Runner->>Loader: run()
    Loader-->>Runner: (blocks until fini/ORB destroy)
    Runner-->>Main: svc() returns 0
Loading

Poem

In burrows deep, with code anew,
A runner hops—its task in view!
The loader’s cleaned, constructors bright,
Smart pointers guide us through the night.
With headers split and builds in tune,
This rabbit’s work will launch soon!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1882aa4 and a89e148.

📒 Files selected for processing (3)
  • ACE/tests/Mem_Map_Test.cpp (1 hunks)
  • TAO/orbsvcs/ImplRepo_Service/Activator_ORB_Runner.cpp (1 hunks)
  • TAO/orbsvcs/ImplRepo_Service/Activator_ORB_Runner.h (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • ACE/tests/Mem_Map_Test.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • TAO/orbsvcs/ImplRepo_Service/Activator_ORB_Runner.cpp
  • TAO/orbsvcs/ImplRepo_Service/Activator_ORB_Runner.h
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: ubuntu-24.04 clang++-14
  • GitHub Check: ubuntu-24.04 g++-10 CodeQL
  • GitHub Check: ubuntu-24.04 g++-12
  • GitHub Check: ubuntu-24.04 g++-11
  • GitHub Check: ubuntu-22.04 clang++-12
  • GitHub Check: VS2022Debug64Cxx17
  • GitHub Check: VS2022Debug64
  • GitHub Check: VS2022Debug64Cxx20
  • GitHub Check: VS2022Release64
  • GitHub Check: VS2022WChar
  • GitHub Check: VS2022Debug32
  • GitHub Check: VS2022Release32
  • GitHub Check: VS2022WChar
  • GitHub Check: MINGW64-gcc
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: alpine-3.18
  • GitHub Check: macos-14-C++
  • GitHub Check: macos-13-C++
  • GitHub Check: windows-2022 vs2022
  • GitHub Check: ubuntu-22.04 g++-12
  • GitHub Check: ubuntu-24.04 g++
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3375743 and 1882aa4.

📒 Files selected for processing (1)
  • TAO/tests/MT_NoUpcall_Client_Leader/chatter.h (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: ubuntu-22.04 clang++-12
  • GitHub Check: ubuntu-24.04 clang++-14
  • GitHub Check: ubuntu-24.04 g++-11
  • GitHub Check: ubuntu-22.04 g++-9
  • GitHub Check: ubuntu-22.04 g++-10
  • GitHub Check: macos-14-C++
  • GitHub Check: macos-13-C++
  • GitHub Check: VS2022Release64
  • GitHub Check: VS2022Debug64
  • GitHub Check: VS2022Debug64Cxx20
  • GitHub Check: VS2022Release32
  • GitHub Check: VS2022Debug64Cxx17
  • GitHub Check: VS2022WChar
  • GitHub Check: VS2022Debug32
  • GitHub Check: VS2022WChar
  • GitHub Check: MINGW64-gcc
  • GitHub Check: alpine-3.18
  • GitHub Check: windows-2022 vs2022
  • GitHub Check: ubuntu-22.04 g++-12
  • GitHub Check: ubuntu-24.04 g++
🔇 Additional comments (1)
TAO/tests/MT_NoUpcall_Client_Leader/chatter.h (1)

13-13: Good use of override specifier.

Adding the override specifier is a modern C++ best practice that provides compile-time verification that this method actually overrides a base class method and improves code self-documentation.

Comment on lines +18 to +19
long nrequests_;
long nreplies_;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify thread safety after removing volatile qualifier.

The removal of volatile from these member variables could introduce race conditions if they're accessed from multiple threads without proper synchronization. While volatile is often misused for thread synchronization, its removal needs careful verification.

Since this is multi-threaded code (MT prefix) and the variables are public, ensure that:

  1. All access to these variables is properly synchronized using the request_reply_count_mutex_
  2. The nrequests() and nreplies() methods provide thread-safe access
  3. No direct access to these variables bypasses the synchronization

🏁 Script executed:

#!/bin/bash
# Description: Verify thread-safe access patterns for nrequests_ and nreplies_ variables
# Expected: All access should be synchronized through methods or protected by mutex

# Check implementation of accessor methods
rg -A 10 "long.*Chatter::nrequests\(\)" --type cpp

# Check for any direct access to these variables
rg -A 3 -B 3 "nrequests_|nreplies_" --type cpp --type h

# Look for mutex usage patterns
rg -A 5 -B 5 "request_reply_count_mutex_" --type cpp

Length of output: 5908


Ensure all reads and writes of nrequests_/nreplies_ are synchronized

The current implementation protects increments with request_reply_count_mutex_, but:

  • The accessors Chatter::nrequests() and Chatter::nreplies() return the raw fields without locking.
  • In client.cpp, there’s a direct read of the public members (worker2.nrequests_, worker2.nreplies_) bypassing any mutex.

These gaps can lead to data races. Please address the following:

• Guard the accessors with the same mutex:

--- a/TAO/tests/MT_NoUpcall_Client_Leader/chatter.cpp
+++ b/TAO/tests/MT_NoUpcall_Client_Leader/chatter.cpp
@@ -1,4 +1,9 @@
-long Chatter::nrequests () { return this->nrequests_; }
+long Chatter::nrequests ()
+{
+  ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, request_reply_count_mutex_, 0);
+  return this->nrequests_;
+}

-long Chatter::nreplies ()  { return this->nreplies_; }
+long Chatter::nreplies ()
+{
+  ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, request_reply_count_mutex_, 0);
+  return this->nreplies_;
+}

• Replace any direct member access in client.cpp with the thread-safe accessors:

--- a/TAO/tests/MT_NoUpcall_Client_Leader/client.cpp
+++ b/TAO/tests/MT_NoUpcall_Client_Leader/client.cpp
@@ -XX,7 +XX,7 @@
- result = (worker2.nrequests_ == worker2.nreplies_) ? 0 : -1;
+ result = (worker2.nrequests() == worker2.nreplies()) ? 0 : -1;

• (Optional) Make nrequests_ and nreplies_ private in chatter.h to prevent accidental direct access.

Implementing these changes will eliminate potential race conditions when reading or writing the counters.

🤖 Prompt for AI Agents
In TAO/tests/MT_NoUpcall_Client_Leader/chatter.h around lines 18-19, the fields
nrequests_ and nreplies_ are accessed without synchronization, causing potential
data races. To fix this, make nrequests_ and nreplies_ private, protect their
accessors by locking request_reply_count_mutex_ before returning the values, and
update client.cpp to replace any direct access to these members with calls to
the thread-safe accessor methods.

@jwillemsen jwillemsen changed the title Put ImR_Activator_ORB_Runner into its own file, use make_unique Put ImR_Activator_ORB_Runner into its own file, use make_unique, fix C++23 warnings Jul 9, 2025
@jwillemsen jwillemsen merged commit 2adb981 into DOCGroup:master Jul 9, 2025
37 checks passed
@jwillemsen jwillemsen deleted the jwi-imrorbrunner branch July 9, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant