We do a lot of builds (as in double-digit servers building non-stop). Sometimes, when a part of the build fails, make -j8 would die with: make: INTERNAL: Exiting with 9 jobserver tokens available; should be 8
With -j16 the error would be 17 instead of 16, etc. I think it's simply an off-by-one error in cleanup code that is almost never run. Attached is a patch that fixes it. We've been running with it for over 5 days now and haven't noticed any problems. Tim
From 2fc5429506b6c1221992f91f5d608598067e3f21 Mon Sep 17 00:00:00 2001 From: Tim Newsome <tnews...@aristanetworks.com> Date: Thu, 13 Oct 2011 14:57:52 -0700 Subject: [PATCH] Fix off-by-one bug in clean_jobserver(). When the exit status is 2, clean_jobserver() would incorrectly write an extra jobserver token to the pipe leading to an internal error message complaining that an extra jobserver token is available. --- main.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index c6989e3..d3b60fc 100644 --- a/main.c +++ b/main.c @@ -3113,14 +3113,19 @@ clean_jobserver (int status) "INTERNAL: Exiting with %u jobserver tokens (should be 0)!", jobserver_tokens); else - while (jobserver_tokens--) - { - int r; - - EINTRLOOP (r, write (job_fds[1], &token, 1)); - if (r != 1) - perror_with_name ("write", ""); - } + { + /* For every token that we have beyond our own, write one to the + pipe. */ + while (jobserver_tokens-- > 1) + { + int r; + + EINTRLOOP (r, write (job_fds[1], &token, 1)); + if (r != 1) + perror_with_name ("write", ""); + } + jobserver_tokens = 0; + } } -- 1.7.4.4
_______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make