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

单进程持续写管道超出缓冲区导致进程无限阻塞 #132

Open
hsbyhub opened this issue Aug 31, 2022 · 1 comment
Open

单进程持续写管道超出缓冲区导致进程无限阻塞 #132

hsbyhub opened this issue Aug 31, 2022 · 1 comment

Comments

@hsbyhub
Copy link

hsbyhub commented Aug 31, 2022

感谢阿里团队开源精神,目前我们在生产环境中大规模部署了tsar, 发现了这个bug,希望对大家有帮助。
在src/output_tcp.c中的output_multi_tcp方法将标准输出重定向到pipe,接下来调用running_check将输出内容到管道,管道默认阻塞模式, 缓冲区一般是8-64k, 缓冲区不足写时,将阻塞进程,造成资源泄漏。
目前我的解决方法为申请pipe后,使用fcntl(out_pipe[1], F_SETPIPE_SZ, LEN_10M) 调整pipe缓冲区大小为足够大,值得注意的是,F_SETPIPE_SZ需要引入/usr/include/linux/fcntl.h才有这个标志。

@ForTheRest
Copy link

ForTheRest commented Aug 31, 2022 via email

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

No branches or pull requests

2 participants