Protobuf Bug Breaks Plugin, Fixable By Update
See original GitHub issueHello Bazel Intelij Plugin Folks,
TL;DR: Sync ingestion broken. Fixable by updating rules_proto to commit 40298556293ae502c66579620a7ce867d5f57311 in WORKSPACE.
More detail: I’d come back the the plugin after a little hiatus (and Android Studio, OS, bazel, plugin, etc. updates) and found something odd indeed. Syncing seemed to finish…but fail, but rendering the plugin broken. Sad times. Console looked like
<aspects all succeeding>
build invocation result: success
Parsing build outputs...
Total rules: 107, new/changed: 107, removed: 0
Reading IDE info result...
Reading IDE info result...
Updating target map
Sync finished
Timing summary:
BlazeInvocation: 35.9s, Prefetching: 0ms, Other: 77ms
Sync failed
Weird, okay. So I launched Android Studio from the command line to look at some logs. Many many instances like the following:
Dec 16, 2020 7:11:51 PM com.google.common.util.concurrent.AggregateFuture log
SEVERE: Input Future failed with Error
java.lang.NoSuchMethodError: java.nio.CharBuffer.flip()Ljava/nio/CharBuffer;
at com.google.repackaged.protobuf.TextFormat$Parser.toStringBuilder(TextFormat.java:1602)
at com.google.repackaged.protobuf.TextFormat$Parser.merge(TextFormat.java:1586)
at com.google.repackaged.protobuf.TextFormat$Parser.merge(TextFormat.java:1558)
at com.google.idea.blaze.base.sync.aspects.strategy.AspectStrategy.readAspectFile(AspectStrategy.java:133)
at com.google.idea.blaze.base.sync.aspects.BlazeIdeInterfaceAspectsImpl.lambda$updateState$8(BlazeIdeInterfaceAspectsImpl.java:486)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:210)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:190)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Aha! So some strange internal issue to the protobuf dependency. Looks like this one, which lists at least protobufs between 3.12.2 and 3.14 (exclusive) as problematic (this plugin is currently pointing to something even older, 3.10).
Anyway, sure enough, if we change the version of rules_proto in the plugin WORKSPACE to a version out of that range, the issue goes away. rules_proto doesn’t support 3.14 yet, so in my test, I moved it up to the last working version it did support (commit 40298556293ae502c66579620a7ce867d5f57311 which is protobuf 3.11.3). Huzzah!
My setup details: Latest stable releases of macOS, bazel, plugin, and Android Studio. Android Studio logs list “JDK: 1.8.0_242-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o”.
Thanks for the work you do! Chris (ex-Googler)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8
Update: Because I needed this change–and some others–to make the the plugin run, I made a fork.
While we’re waiting for an official response, check it out if you want this fix and others. https://github.com/hedronvision/bazelbuild-intellij
(Would be delighted to submit a PR, but I think I shouldn’t until I hear from maintainers, based on the contribution guidelines. But you can see the diff corresponding to the change in the commit auto-linked above.)
Closing this issue as #2437 was merged and the fix will be available in the next release. Thanks everyone for the help here!