Skip to content

Commit 2531563

Browse files
authored
okhttp: Ignore known conscrypt socket close issue (#10811) (#10812)
This stops an exception from being thrown when a known Conscrypt synchronization issue happens.
1 parent 5b082ca commit 2531563

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java

+10
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,7 @@ class ClientFrameHandler implements FrameReader.Handler, Runnable {
10981098
}
10991099

11001100
@Override
1101+
@SuppressWarnings("Finally")
11011102
public void run() {
11021103
String threadName = Thread.currentThread().getName();
11031104
Thread.currentThread().setName("OkHttpClientTransport");
@@ -1130,6 +1131,15 @@ public void run() {
11301131
frameReader.close();
11311132
} catch (IOException ex) {
11321133
log.log(Level.INFO, "Exception closing frame reader", ex);
1134+
} catch (RuntimeException e) {
1135+
// This same check is done in okhttp proper:
1136+
// https://github.com/square/okhttp/blob/3cc0f4917cbda03cb31617f8ead1e0aeb19de2fb/okhttp/src/main/kotlin/okhttp3/internal/-UtilJvm.kt#L270
1137+
1138+
// Conscrypt in Android 10 and 11 may throw closing an SSLSocket. This is safe to ignore.
1139+
// https://issuetracker.google.com/issues/177450597
1140+
if (!"bio == null".equals(e.getMessage())) {
1141+
throw e;
1142+
}
11331143
}
11341144
listener.transportTerminated();
11351145
Thread.currentThread().setName(threadName);

0 commit comments

Comments
 (0)