-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Force line-buffering for stderr #3701
Conversation
(Is there a better tag/prefix/whatever for this than |
@@ -3129,6 +3129,7 @@ void LoadEnvironment(Environment* env) { | |||
// thrown during process startup. | |||
try_catch.SetVerbose(true); | |||
|
|||
setvbuf(stderr , NULL , _IOLBF , 1024); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the right place for a call to setvbuf, it's too late after startup. It should probably be the first thing in main() or node::Init()
and even that is possibly not soon enough because of printf calls from static constructors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a separate testing branch, I moved it to main()
.
I had it run the test on SmartOS 500 times and there were no failures. https://ci.nodejs.org/job/node-test-commit-smartos/246/
Then I commented out the line.
bf88e85
And ran the test again and got multiple failures.
https://ci.nodejs.org/job/node-test-commit-smartos/247/
I'll move the setvbuf()
to main()
or anywhere else that seems more appropriate.
@@ -41,6 +41,7 @@ int wmain(int argc, wchar_t *wargv[]) { | |||
#else | |||
// UNIX | |||
int main(int argc, char *argv[]) { | |||
setvbuf(stderr , NULL , _IOLBF , 1024); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there shouldn't be a space immediately after each of the first three arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly, I need to up my cut-and-paste game. Extraneous spaces removed. Thanks!
@Trott should probably be |
SmartOS does not line buffer stderr by default, or at least that is the behavior on the Node project Jenkins server. Force line buffering. This resolves the flakiness observed on SmartOS for test-debug-signal-cluster. Fixes: nodejs#2476 Refs: nodejs#3615
@jbergstroem Cool. Changed the commit message, squashed the commits into a single commit and force pushed. Anyone feel comfortable giving this one a thumbs up (assuming CI comes back green)? |
hmm... would this need to be semver-minor or higher? |
@jasnell I don't think so. I think it only affects messages sent by the Node debugger which bypasses Anyway, if it increased your comfort level to have it at |
LGTM. This is semver-patch IMO, it only affects fprintf statements in src/, not |
👍 LGTM |
Kewl. I'm waiting on the return of the CI server to do one last rebased-against-master CI run before landing... |
LGTM |
OK to land despite OSX + Arm buildbot problems on CI? |
@Trott if you've tested locally on a mac I'd say go for it. I'm +1 to patchlevel. |
SmartOS does not line buffer stderr by default, or at least that is the behavior on the Node project Jenkins server. Force line buffering. This resolves the flakiness observed on SmartOS for test-debug-signal-cluster. PR-URL: nodejs#3701 Fixes: nodejs#2476 Refs: nodejs#3615 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Landed in 0966ab9. |
SmartOS does not line buffer stderr by default, or at least that is the behavior on the Node project Jenkins server. Force line buffering. This resolves the flakiness observed on SmartOS for test-debug-signal-cluster. PR-URL: #3701 Fixes: #2476 Refs: #3615 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
should this land in LTS? |
hey, this is a good one to discuss at an LTS WG meeting—the change itself is a good one but who knows what weird use is out there that may be depending on existing behaviour, perhaps it's not worth the trouble to backport? |
looks like we missed talking about this at todays meeting. @jasnell should we add a label for LTS discussions? |
Yeah, if you'd like go ahead and create an lts-agenda label for this repo.
|
This is flagged as lts-watch but needs to be discussed before landing... |
@nodejs/lts can you please weigh in on this one? |
From these two comments
If you |
LGTM to v4.4 |
SmartOS does not line buffer stderr by default, or at least that is the behavior on the Node project Jenkins server. Force line buffering. This resolves the flakiness observed on SmartOS for test-debug-signal-cluster. PR-URL: #3701 Fixes: #2476 Refs: #3615 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
SmartOS does not line buffer stderr by default, or at least that is the behavior on the Node project Jenkins server. Force line buffering. This resolves the flakiness observed on SmartOS for test-debug-signal-cluster. PR-URL: #3701 Fixes: #2476 Refs: #3615 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
SmartOS does not line buffer stderr by default, or at least that is the behavior on the Node project Jenkins server. Force line buffering. This resolves the flakiness observed on SmartOS for test-debug-signal-cluster. PR-URL: #3701 Fixes: #2476 Refs: #3615 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: #2476
Refs: #3615
On CI, it appears that stderr on SmartOS is not line buffered and that was resulting in some interleaving in test-debug-signal-cluster, causing the test to be flaky. This change forces stderr to be line-buffered, fixing the issue.