-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Fix stdout_sink_base::log's behavior inconsistency #2646
Conversation
It will flush every time when it if not defined _WIN32, but not in Windows family. We viewed the commit #48d4ed9 for fixing issue #1675 . It seems missing this flushing operation in mistake.
please use fflush in both cases. |
@gabime I moved the ffush out of the ifdefine. |
@25077667 After closer examination I think the original behavior is consistent in both platforms since the windows impl use WriteFile which means no libc memory buffer to be fflushed. Note that fflush only flush the libc buffer. It doesnt call fsync. So I think this PR is not needed. |
@gabime Well, I found this issue from our team's CI. We used gtest framework to capture the stdout stream. We always could capture the output from SPDLOG_ERROR in Linux and MacOS, but not Windows "sometime". After I traced code to here, I add Honestly speaking, I'm not quite sure what's the behavior after invoke the Window API. |
If you are absolutely sure that fflush fixes the issue I don’t mind to add it (and also remove the call to fflush in line #63) |
@gabime I believe we can keep an eye on things for a week and report back. |
Hello @gabime, It was monitored for a week, and over 40 runs were completed successfully (never trigger any flushing bug issue). |
Hello @gabime , After a month, we tested over 200 times via our CI. |
Ok. I reopen the pr. Please remove the the redundant |
@gabime , |
Merged. Thanks @25077667 |
It will flush every time when it if not defined _WIN32, but not in Windows family.
We viewed the commit 48d4ed9 for fixing issue #1675 . It seems missing this flushing operation in mistake.