Skip to content
New issue

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

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

Already on GitHub? # to your account

zlog is blocked at the write() system call, causing the program to hang. #249

Open
forxn9 opened this issue Feb 19, 2024 · 2 comments
Open

Comments

@forxn9
Copy link

forxn9 commented Feb 19, 2024

#define PRINT_INFO(fmt,...)
do{
zlog_info(zc,fmt,##VA_ARGS);
}while(0)

The program hangs during the use of zlog_info. By examining the stack with gdb, it is confirmed that the program is blocked at the write() system call. The detailed stack information is as follows:

bt.txt

@forxn9
Copy link
Author

forxn9 commented Feb 19, 2024

For example, thread 4, after calling the zlog_rule_output_static_file_single function, remains blocked at the write function.
(gdb) thread 4
[Switching to thread 4 (Thread 0x7f8967d200 (LWP 6682))]
#0 0x0000007f8a8cea38 in write () from /lib/libpthread.so.0
(gdb) bt
#0 0x0000007f8a8cea38 in write () from /lib/libpthread.so.0
#1 0x0000007f8a88d864 in zlog_rule_output_static_file_single (
a_rule=0x1788eee0, a_thread=0x7f70000910) at rule.c:122
#2 0x0000007f8a889a84 in zlog_category_output (
a_category=a_category@entry=0x177aed20,
a_thread=a_thread@entry=0x7f70000910) at category.c:229
#3 0x0000007f8a894ab4 in zlog (category=0x177aed20,
file=0x41c4f0 "fj_gnss.c", filelen=9,
func=0x41ce38 <func.6343> "check_crc", funclen=9, line=1936, level=0,
format=0x41c8b0 "[gnss] crc check failed! 0x%08x 0x%08x buf=[%s]\n")
at zlog.c:860

@forxn9
Copy link
Author

forxn9 commented Feb 19, 2024

a_rule->static_fd = open(a_rule->file_path, O_WRONLY | O_APPEND | O_CREAT | a_rule->file_open_flags, a_rule->file_perms);
此处对于文件的写入,是否可以直接添加 O_NONBLOCK进行非阻塞式写入
ping 各位大佬 @hydrogen18 @bmanojlovic @mofaph @pcorbes

@forxn9 forxn9 changed the title zlog阻塞在write()系统调用,导致程序卡死 zlog is blocked at the write() system call, causing the program to hang. Feb 19, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant