Skip to content

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

Draft
cbalint13 wants to merge 1 commit into
apache:mainfrom
cbalint13:tvmrpc-std
Draft

[CPP_RPC] Replace legacy OS-specific API with std:: libraries#19840
cbalint13 wants to merge 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 much safer and portable std::filesystem
  • Worker process remains fork()-ed, due to mandatory kill() enforcement on timeout
  • Timer process is migrated from fork() to main with WNOHANG (nonblock) pid check
  • Dont "guess" anymore which fork() will "die/end" first, watch a single fork()-ed worker
  • Cleanup ambiguous doc entries , inconsistent default port ranges 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
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.

1 participant