Repository navigation
Closed
Labels
P0This is an emergency and more important than other current work. (Assignee required)breakagecategory: misc > miscplatform: windowstype: bug
Description
After upgrading our Buildkite VMs to Bazel 0.16.0, we noticed that Bazel reproducibly crashes with a StackOverflow a few seconds after it starts building:
I managed to repro this manually on the Windows VM and grabbed the jvm.out log:
Can't load log handler "java.util.logging.FileHandler"
java.nio.file.NoSuchFileException: c:users\philwo\_bazel~1\ozmjprom\java.log.lck
java.nio.file.NoSuchFileException: c:users\philwo\_bazel~1\ozmjprom\java.log.lck
at java.base/sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at java.base/sun.nio.fs.WindowsFileSystemProvider.newFileChannel(Unknown Source)
at java.base/java.nio.channels.FileChannel.open(Unknown Source)
at java.base/java.nio.channels.FileChannel.open(Unknown Source)
at java.logging/java.util.logging.FileHandler.openFiles(Unknown Source)
at java.logging/java.util.logging.FileHandler.<init>(Unknown Source)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.base/java.lang.Class.newInstance(Unknown Source)
at java.logging/java.util.logging.LogManager.createLoggerHandlers(Unknown Source)
at java.logging/java.util.logging.LogManager.access$1300(Unknown Source)
at java.logging/java.util.logging.LogManager$4.run(Unknown Source)
at java.logging/java.util.logging.LogManager$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.logging/java.util.logging.LogManager.loadLoggerHandlers(Unknown Source)
at java.logging/java.util.logging.LogManager.initializeGlobalHandlers(Unknown Source)
at java.logging/java.util.logging.LogManager.access$1800(Unknown Source)
at java.logging/java.util.logging.LogManager$RootLogger.accessCheckedHandlers(Unknown Source)
at java.logging/java.util.logging.Logger.getHandlers(Unknown Source)
at java.logging/java.util.logging.Logger.log(Unknown Source)
at java.logging/java.util.logging.Logger.doLog(Unknown Source)
at java.logging/java.util.logging.Logger.log(Unknown Source)
at java.logging/java.util.logging.Logger.info(Unknown Source)
at com.google.devtools.build.lib.analysis.BlazeVersionInfo.logVersionInfo(BlazeVersionInfo.java:64)
at com.google.devtools.build.lib.analysis.BlazeVersionInfo.setBuildInfo(BlazeVersionInfo.java:79)
at com.google.devtools.build.lib.bazel.Bazel.main(Bazel.java:65)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/C:/Users/philwo/_bazel_philwo/install/d522db92d7621d404f960f24e49d0696/_embedded_binaries/A-server.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.StackOverflowError
at java.base/java.util.concurrent.FutureTask.finishCompletion(Unknown Source)
at java.base/java.util.concurrent.FutureTask.set(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Exception: java.lang.StackOverflowError thrown from the UncaughtExceptionHandler in thread "Command-Accumulator-Thread-19"
@buchgr and my theory is that it must be caused by one of the last three cherry-picks that went into 0.16.0, because apparently 0.16.0rc3 was tested with downstream projects (which should have showed this issue), but 0.16.0rc4 (which became the final version) wasn't:
Metadata
Metadata
Assignees
Labels
P0This is an emergency and more important than other current work. (Assignee required)breakagecategory: misc > miscplatform: windowstype: bug
Activity
philwo commentedon Aug 1, 2018
Interestingly, we also had one successful run with Bazel 0.16.0 on Windows: https://buildkite.com/bazel/bazel-bazel/builds/3703#4638243b-5e19-47ba-9cd6-806cf1f49248
laszlocsomor commentedon Aug 1, 2018
The problem seems to be a bad path, see the 2nd line of your log:
The backslash is missing after "c:". I'll look into it.
laszlocsomor commentedon Aug 1, 2018
Haha, never mind, that has nothing to do with the StackOverflow :)
9 remaining items
philwo commentedon Aug 8, 2018
@meteorcloudy I don't think that commit is in Bazel 0.16.0 (it uses OpenJDK 9), though?
meteorcloudy commentedon Aug 8, 2018
@philwo You are right
meteorcloudy commentedon Aug 8, 2018
I'm running bisect from 0.15.2's base commit to 0.16.0's base commit. It will take some time.
buchgr commentedon Aug 8, 2018
@meteorcloudy if you want to rule out that the JDK9 is at fault, please use #5786 which is the 0.16.0 code base with JDK8.
meteorcloudy commentedon Aug 8, 2018
@buchgr Are we using JDK9 in 0.15.2?
buchgr commentedon Aug 8, 2018
@meteorcloudy no
buchgr commentedon Aug 8, 2018
The error seems to always happen in a
Command-Accumulator-Thread-*thread. Looking at the code, we specifically limit the stack size of these threads to32 KiB(presumably to lower the memory consumption). Now, the default stack size on 64-bit windows is1 MiB[1]. I think if @meteorcloudy finds the JDK9 change to be at fault, then a likely explanation is the implementation of the thread pool changed and now requires more than 32 KiB in stack size.[1] http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#threads_oom
meteorcloudy commentedon Aug 8, 2018
I have confirmed it didn't fail on #5786, testing a possible fix suggested by @buchgr
c-parsons commentedon Aug 8, 2018
I'm a little unclear on the root cause here -- do we anticipate this is a JDK9 issue that would be fixed by the commits in #5760 ?
cushon commentedon Aug 8, 2018
@c-parsons no, I think this is unrelated to #5760.
meteorcloudy commentedon Aug 9, 2018
@c-parsons Yes, this issue is gone if we revert JDK version to 8. But @buchgr has figured out a fix to make it work with JDK9 as well. I was running a test for a Bazel version of 0.16.0 with his fix all night, it didn't fail after 100 times rerun.
#5760 is irrelevant to this issue, I'm ccing you in the internal CL for fixing this.
Fix StackOverflowError on Windows. Fixes bazelbuild#5730
Release 0.16.1 (2018-08-13)
Fix StackOverflowError on Windows. Fixes #5730