Skip to content
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

Protobuf Bug Breaks Plugin, Fixable By Update #2265

Closed
cpsauer opened this issue Dec 18, 2020 · 8 comments
Closed

Protobuf Bug Breaks Plugin, Fixable By Update #2265

cpsauer opened this issue Dec 18, 2020 · 8 comments
Assignees
Labels
os: macos macOS support product: Android Studio Android Studio plugin topic: sync Issues related to the sync operation type: bug

Comments

@cpsauer
Copy link
Contributor

cpsauer commented Dec 18, 2020

Hello 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)

@ayakushev99
Copy link

Had the same issue, the same fix worked for me, thanks!

@cpsauer
Copy link
Contributor Author

cpsauer commented Dec 23, 2020

Glad it was handy :)

Uploading my (working) Android Studio build for anyone else who might find it handy.
aswb_bazel.zip See update, below.

cpsauer added a commit to hedronvision/bazelbuild-intellij that referenced this issue Feb 3, 2021
@cpsauer
Copy link
Contributor Author

cpsauer commented Feb 4, 2021

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.)

@mai93 mai93 added topic: sync Issues related to the sync operation type: bug product: Android Studio Android Studio plugin os: macos macOS support labels Feb 8, 2021
@Kernald
Copy link

Kernald commented Mar 15, 2021

Note that this is tagged as topic: macos but affects Linux as well.

@BenHenning
Copy link

Confirming I also ran into this today, and @cpsauer's fix worked (thank you so much for the plugin update Chris--this saved me a considerable amount of time).

If the team would like a project to repro this on, feel free to use https://github.com/oppia/oppia-android. Trying to 'partially syncing' the top-level '/model' folder (which contains our protos) will consistently hit this issue. Note: don't try to build the whole project since it requires not-yet released Bazel changes to properly build, but that shouldn't affect reproing this issue.

@AlexeyGy AlexeyGy self-assigned this Mar 16, 2021
copybara-service bot pushed a commit that referenced this issue Mar 16, 2021
Issue #2265 described a bug which broke the plugin due to an already fixed protobuf issue protocolbuffers/protobuf#7827 the issue author created a fork in https://github.com/hedronvision/bazelbuild-intellij.

PiperOrigin-RevId: 363130962
@AlexeyGy
Copy link
Collaborator

Thanks for raising this @cpsauer and thanks for providing the example @BenHenning, we are currently looking into testing and integrating the suggested changes upstream.

copybara-service bot pushed a commit that referenced this issue Mar 16, 2021
Issue #2265 described a bug which broke the plugin due to an already fixed protobuf issue protocolbuffers/protobuf#7827 the issue author created a fork in https://github.com/hedronvision/bazelbuild-intellij.

PiperOrigin-RevId: 363130962
copybara-service bot pushed a commit that referenced this issue Mar 16, 2021
Issue #2265 described a bug which broke the plugin due to an already fixed protobuf issue protocolbuffers/protobuf#7827 the issue author created a fork in https://github.com/hedronvision/bazelbuild-intellij.

PiperOrigin-RevId: 363188004
@nkoroste
Copy link
Contributor

@vsiva can you help direct this to the right person?

@alice-ks
Copy link
Collaborator

Closing this issue as #2437 was merged and the fix will be available in the next release. Thanks everyone for the help here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: macos macOS support product: Android Studio Android Studio plugin topic: sync Issues related to the sync operation type: bug
Projects
None yet
Development

No branches or pull requests

8 participants