Skip to content

Fix GetProgramName not contains absolute path from cmdline#2644

Merged
yanglimingcn merged 2 commits into
apache:masterfrom
ehds:fix-can-not-recognize-absolute-path-from-cmdline
May 19, 2024
Merged

Fix GetProgramName not contains absolute path from cmdline#2644
yanglimingcn merged 2 commits into
apache:masterfrom
ehds:fix-can-not-recognize-absolute-path-from-cmdline

Conversation

@ehds

@ehds ehds commented May 15, 2024

Copy link
Copy Markdown
Contributor

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:

  • Linux 系统使用 readlink(/proc/self/exe) 获取程序绝对路径
  • MacOSX 系统使用 proc_pidpath 获取当前进程的绝对路径

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@ehds ehds force-pushed the fix-can-not-recognize-absolute-path-from-cmdline branch from 4e4e46a to 8baf6d1 Compare May 15, 2024 02:53
@ehds ehds changed the title Fix GetProgramName not contains absolute path from cmdline. Fix GetProgramName not contains absolute path from cmdline May 15, 2024
@ehds ehds force-pushed the fix-can-not-recognize-absolute-path-from-cmdline branch from 35042a5 to 9f61626 Compare May 15, 2024 11:15
@yanglimingcn

Copy link
Copy Markdown
Contributor

LGTM

@yanglimingcn yanglimingcn merged commit ff140be into apache:master May 19, 2024
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