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

bthread能否引入STW进行实时打印 #2389

Closed
vinllen opened this issue Sep 19, 2023 · 8 comments · Fixed by #2851
Closed

bthread能否引入STW进行实时打印 #2389

vinllen opened this issue Sep 19, 2023 · 8 comments · Fixed by #2851

Comments

@vinllen
Copy link

vinllen commented Sep 19, 2023

Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)
tools工具下有个gdb_bthread_stack.py脚本,但是需要gdb attach,会导致gdb挂起,而且性能非常挫,bthread是否可以加一个STW,然后打印bthred stack,类似golang runtime中的实现。

Describe the solution you'd like (描述你期望的解决方法)

Describe alternatives you've considered (描述你想到的折衷方案)

Additional context/screenshots (更多上下文/截图)

@wwbmmm
Copy link
Contributor

wwbmmm commented Sep 19, 2023

STW需要语言级别支持吧。对于C++来说,好像只有gdb挂起才能把线程安全地停住吧

@vinllen
Copy link
Author

vinllen commented Sep 20, 2023

gdb挂起感觉性能代价比较大,STW比如在协程分配的时候锁内保护,STW也在锁内,不过实现代价是比较高。

@chenBright
Copy link
Contributor

@vinllen 可以看看#2797

@vinllen
Copy link
Author

vinllen commented Nov 14, 2024

牛批 这个功能对我们帮助很大

@chenBright
Copy link
Contributor

你们在什么场景下需要打印bthread调用栈呢?

@vinllen
Copy link
Author

vinllen commented Nov 20, 2024

多种场景吧,比如进程hang住、或者排查长延迟的情况,类似pstack查看调用栈情况,只是bthread之前没有这个功能。

@chenBright
Copy link
Contributor

chenBright commented Jan 6, 2025

@vinllen 可以看看#2797

CC @vinllen

@vinllen
Copy link
Author

vinllen commented Jan 8, 2025

收到,我们内部试一下

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 a pull request may close this issue.

3 participants