Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(collector): no validate the app_name after parse_app_perf_counter_name #514

Merged
merged 2 commits into from
Apr 13, 2020

Conversation

foreverneverer
Copy link
Contributor

@foreverneverer foreverneverer commented Apr 13, 2020

What problem does this PR solve?

Related Coredump

#0  get_app_partition_stat (sc=sc@entry=0x3753450, rows=...) at /home/jiashuo1/work/pegasus/src/server/../shell/command_helper.h:784
#1  0x00000000004c43ad in pegasus::server::info_collector::on_app_stat (this=0x3753420) at /home/jiashuo1/work/pegasus/src/server/info_collector.cpp:136
#2  0x00007ff0d894cf61 in operator() (this=0x38d40e4) at /home/jiashuo1/app/toolchain/output/include/c++/4.8.2/functional:2464
#3  dsn::timer_task::exec (this=0x38d4014) at /home/jiashuo1/work/pegasus/rdsn/src/core/core/task.cpp:475
#4  0x00007ff0d894e059 in dsn::task::exec_internal (this=this@entry=0x38d4014) at /home/jiashuo1/work/pegasus/rdsn/src/core/core/task.cpp:180
#5  0x00007ff0d89a4c7d in dsn::task_worker::loop (this=0x3110bb0) at /home/jiashuo1/work/pegasus/rdsn/src/core/core/task_worker.cpp:211
#6  0x00007ff0d89a4e49 in dsn::task_worker::run_internal (this=0x3110bb0) at /home/jiashuo1/work/pegasus/rdsn/src/core/core/task_worker.cpp:191
#7  0x00007ff0d530f600 in std::(anonymous namespace)::execute_native_thread_routine (__p=<optimized out>) at /home/qinzuoyan/git.xiaomi/pegasus/toolchain/objdir/../gcc-4.8.2/libstdc++-v3/src/c++11/thread.cc:84
#8  0x00007ff0d5e21dc5 in start_thread () from /lib64/libpthread.so.0
#9  0x00007ff0d4a7973d in clone () from /lib64/libc.so.6

Reason

#499 add parse_app_perf_counter_name to parse perf_counter_name, but no check whether the app_name from perf_counter_name is existed in dsn::app_status::AS_AVAILABLE type apps. for example, the app was dropped and the app_name should be ignored, otherwise the code line 783 will get error result and crash at line 784.

https://github.com/XiaoMi/pegasus/blob/1a1fc190d9eac42ce359dc356483ae06d583ab8b/src/shell/command_helper.h#L781-L785

What is changed and how it works?

Check if the app_name existed.

Check List

Tests

  • Manual test (add detailed scripts or steps below)
    • Deploy the latest code and run for while.
    • Make sure the app_name(for example, the temp app) has the perf-counter.
    • Drop the temp app.
    • Check if collector crash and generate core dump file after runnning for a while.
    • The result is: collector runs well and no core dump file.

Related changes

@foreverneverer foreverneverer changed the title fix: no validate the app_name after parse_app_perf_counter_name fix(collector): no validate the app_name after parse_app_perf_counter_name Apr 13, 2020
@neverchanje neverchanje added the type/bug-fix This PR fixes a bug. label Apr 13, 2020
@neverchanje neverchanje merged commit 4cdaa53 into apache:master Apr 13, 2020
@neverchanje neverchanje mentioned this pull request May 14, 2020
@neverchanje neverchanje mentioned this pull request Jun 10, 2020
acelyc111 pushed a commit that referenced this pull request Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug-fix This PR fixes a bug. v2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants