apache / brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
https://brpc.apache.org
Apache License 2.0
16.05k stars 3.92k forks source link

Fix GetProgramName not contains absolute path from cmdline #2644

Closed ehds closed 1 month ago

ehds commented 1 month ago

What problem does this PR solve?

Issue Number:

Problem Summary:

从 cmdline 中获取程序名称时不包含程序的完整路径。因为程序的启动路径可能已经包含在了 $PATH 中,所以 cmdline 中只有程序的名称而没有路径信息,导致在使用 ProgramCHECKSUM 以及使用 heap profile 解析符号时找不到程序的具体位置而导致失败。

复现:

export PATH=$PATH:/path/to/echo_server

启动server

echo_server

获取程序的校验码会报错:

E20240515 10:57:13.508802 39562 common.cpp:318] Fail to open `echo_server': No such file or directory [2]

使用 Heap Profiler 会解析不了.

[20240515.110220.heap]
Using remote profile at echo_server.
Using local file ./rpc_data/profiling/000000000000000000000000ce010000/20240515.110220.heap.
The first profile should be a remote form to use /pprof/symbol

What is changed and the side effects?

Changed:

Side effects:


Check List:

yanglimingcn commented 1 month ago

LGTM