-
Notifications
You must be signed in to change notification settings - Fork 721
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
多线程环境,fork后的子进程中,如果继续使用log记录日志,有几率出现死锁 #62
Comments
写锁只在重新加载配置的时候才用,这种概率你都碰上了? |
应该不是加载配置,我用的是1.2.9版本的,阻塞的地方在这里: |
哦,是读锁阻塞住了,但整个进程都没有加载配置的地方,除了初始化, |
多进程写同一日志文件支持吗 |
这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。
|
pid = fork()
if (pid == 0)
{
log_info("test."); // 这里可能会造成死锁
}
执行fork的时候,如果有别的线程已经加了写锁,fork后的子进程也会处于写锁的状态,
这个时候,子进程再写日志,会出现死锁。
现在规避的方案是fork后,子进程不要调用log记录日志,不知道是否还有更好的方法
The text was updated successfully, but these errors were encountered: