Skip to content

[CPP_RPC] Replace legacy OS-specific API with std:: libraries#19840

Merged
tqchen merged 1 commit into
apache:mainfrom
cbalint13:tvmrpc-std
Jun 19, 2026
Merged

[CPP_RPC] Replace legacy OS-specific API with std:: libraries#19840
tqchen merged 1 commit into
apache:mainfrom
cbalint13:tvmrpc-std

Conversation

@cbalint13

@cbalint13 cbalint13 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Replaces OS dependent API with standard cpp libraries in the tvm_rpc tool.


  • Replace all filesystem calls with safe and portable std::filesystem
  • Worker process remains fork()-ed (POSIX), due to kill() enforcement on timeout
  • Timer process is migrated from fork() to main with WNOHANG (nonblock) pid watcher
  • Watch a single fork()-ed worker, no more "guess" on which fork() will "die/end" first
  • Cleanup ambiguous doc entries, consistent default parameters across various places

Currently tested with real tuning processes but limited to linux machines.

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

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.

Code Review

This pull request modernizes the C++ RPC server by refactoring file system operations to use C++17 <filesystem> and replacing the double-fork watchdog mechanism with a cleaner thread-based watchdog. Feedback focuses on critical security and robustness improvements: restricting directory permissions from world-writable (0777) to owner-only (0700) to prevent local privilege escalation, resolving a potential race condition where a recycled PID could be killed by the watchdog thread, and using the std::error_code overload of std::filesystem::create_directories to avoid potential crashes from unhandled exceptions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread apps/cpp_rpc/rpc_env.cc Outdated
Comment thread apps/cpp_rpc/rpc_env.cc Outdated
Comment thread apps/cpp_rpc/rpc_server.cc Outdated
Comment thread apps/cpp_rpc/rpc_env.cc Outdated
Comment thread apps/cpp_rpc/rpc_env.cc Outdated
Comment thread apps/cpp_rpc/rpc_env.cc Outdated
@cbalint13 cbalint13 marked this pull request as draft June 19, 2026 10:08
@cbalint13 cbalint13 force-pushed the tvmrpc-std branch 4 times, most recently from 35e3f85 to 223e64b Compare June 19, 2026 11:06
@cbalint13 cbalint13 changed the title [CPP_RPC] Replace lagacy OS-specific API with std:: libraries [CPP_RPC] Replace legacy OS-specific API with std:: libraries Jun 19, 2026
@cbalint13 cbalint13 force-pushed the tvmrpc-std branch 3 times, most recently from 9caf5bc to f1c9fb9 Compare June 19, 2026 11:57
@cbalint13 cbalint13 marked this pull request as ready for review June 19, 2026 13:32
@cbalint13

Copy link
Copy Markdown
Contributor Author

This is ready to review.
Cc @tqchen

@tqchen tqchen merged commit 1b900a3 into apache:main Jun 19, 2026
12 checks passed
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