question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Okio 2.x incompatibilities

See original GitHub issue

What version of gRPC-Java are you using?

1.36.0

What is your environment?

Linux and macOS, built with Bazel from sources using the tools provided in this repo, rather than through a Maven dependency. The same repo contains an Android app using OkHttp3 (4.9.1), which depends on Okio 2.8+.

What did you expect to see?

gRPC-Java should build just fine.

What did you see instead?

gRPC-Java either overrides the dependencies and force Okio 1.x (which causes issues with OkHttp3, e.g. https://github.com/square/okhttp/issues/5378), or fails to compile when using Okio 2.8+. For example: https://github.com/grpc/grpc-java/blob/b2e475712d67a0660e1d16d6465a4ccb9b8a6b40/okhttp/src/main/java/io/grpc/okhttp/OkHttpReadableBuffer.java#L43 buffer.readByte() now throws an exception, which causes a compilation error as it’s not caught or thrown by readUnsignedByte(). This points to incompatibilities between Okio 1.x and 2.x, and makes adopting gRPC-Java in any repo using “recent” (mid-2019…) versions of OkHttp an issue. OkHttp3 has been depending on Okio 2.x since its 4.0.0 release.

Steps to reproduce the bug

Depend on both OkHttp3 4.x and gRPC-Java at the same time.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ejona86commented, Mar 22, 2021

I’m using gRPC-Java in a Bazel repo

Oh, okay. Then we’ll need to get this fixed up. Since EOFException is a checked exception build will fail if we continue using okio 1.x in our build. We can workaround that by making a trash function that just “throws EOFException” and calling it within the try.

Out of curiosity, is bumping the Okio version pulled by gRPC-Java something that could be considered and/or done?

I’ve considered it on multiple occasions. The additional dependencies would be a bit of a pain as users pick them up, but could be dealt with. But I sort of hate looking through the Kotlin code (I can’t read it) so I’ve not been eager to personally push that upgrade forward.

0reactions
Kernaldcommented, Mar 22, 2021

No worries, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Okio - Square Open Source
Okio 2.x supports Android 4.0.3+ (API level 15+) and Java 7+. Okio 3.x supports Android 4.0.3+ ... It is a small library with...
Read more >
Announcing Okio 2 | Square Corner Blog
Compatibility. The new release is binary-compatible with Okio 1.15.0. You can replace the old .jar file with the new one and your ...
Read more >
[JENKINS-57411] Upgrade github-branch-source-plugin to use ...
x may be incompatible if clients are using obsolete classes/methods. * OkHttp 3.12.2 is the last version that is reasonably compatible with 2.7.5....
Read more >
GRPC-Java v1.37.0 Released - Google Groups
... okhttp: support compiling with okio 2.x API for Bazel users. ... Fixed an UnsupportedOperationException incompatibility with Netty ...
Read more >
Library Migration: A Retrospective Analysis and Tool
We find that library migration leads to significant compatibility ... They released Jackson version 2.x which changed the name of their ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found