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

Fixed the issue where the Crash Stace Trace of the C++ part was overwritten by the Golang stack when starting the Golang module. #2171

Merged
merged 5 commits into from
Apr 1, 2025

Conversation

linrunqi08
Copy link
Collaborator

@linrunqi08 linrunqi08 commented Mar 28, 2025

问题原因:
C++模块,启动的时候,会在比较靠前的位置InitCrashBackTrace()。InitCrashBackTrace会去注册SIGSEGV和SIGABRT的信号处理。然后启动Golang模块,Golang启动的时候,应该会去覆盖SIGSEGV和SIGABRT的信号处理

解决方案:
Golang启动之后,C++的信号处理重新设置一下即可。

测试方案:
C++ crash:
void Application::Start() 函数中,在LogtailPlugin::GetInstance()->LoadPluginBase();之后,设置空指针报错:
{
int* ptr = nullptr; // 声明一个空指针
std::cout << *ptr << std::endl; // 尝试解引用空指针,导致崩溃
}
本次修改之前的堆栈:
image
本次修改之后的堆栈:
image

Golang crash:
本次修改之前的堆栈:
手动panic
image
空指针
image

本次修改之后的堆栈:
手动panic
image
空指针
image

@yyuuttaaoo
Copy link
Collaborator

Go crash的前后对比能补充一个看看不

Copy link
Collaborator

@henryzhx8 henryzhx8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linrunqi08
Copy link
Collaborator Author

Go crash的前后对比能补充一个看看不

已补充

@linrunqi08 linrunqi08 merged commit a5a7877 into main Apr 1, 2025
15 of 19 checks passed
@henryzhx8 henryzhx8 added the bug Something isn't working label Apr 1, 2025
@henryzhx8 henryzhx8 added this to the v3.0 milestone Apr 1, 2025
@henryzhx8 henryzhx8 deleted the feature/taiye/fix_crash_trace branch April 1, 2025 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants