grpc/grpc-java · info · UnsupportedOperationException
Unsupported operation setPerformancePreferences()
Error message
Unsupported operation setPerformancePreferences()
What it means
setPerformancePreferences() hints at TCP connection parameters (connection time vs latency vs bandwidth); the JVM/Android never fully implemented it and it is meaningless for a Unix domain socket. UdsSocket throws UnsupportedOperationException unconditionally.
Solutions
- Drop the call for UDS channels — performance preferences are a no-op hint even on TCP and are unsupported here
- Tune performance at the gRPC level (message sizes, compression, executor threads) instead of socket hints
- Remove setPerformancePreferences from shared socket setup utilities
Example fix
// before socket.setPerformancePreferences(0, 2, 1); // after // no socket-level hint for UDS; tune at channel level instead
Defensive patterns
Strategy: validation
Validate before calling
if (socket instanceof io.grpc.android.UdsSocket) return; // skip performance preferences
Type guard
static boolean acceptsPerfPreferences(java.net.Socket s) { return !(s instanceof io.grpc.android.UdsSocket); } Prevention
- Drop setPerformancePreferences entirely — it is a no-op hint even on TCP
- Tune performance via gRPC channel options instead of socket hints
When it happens
Trigger: Direct call to UdsSocket.setPerformancePreferences(int,int,int), or legacy socket-tuning code migrated alongside a UDS gRPC channel.
Common situations: Copying old TCP tuning snippets into UDS channel setup; performance-profiling frameworks that apply preference hints to every socket.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- getChannel() not supported
- getInetAddress() not supported
- OkHttpChannelBuilder not found on the classpath
- Unsupported operation getKeepAlive()
- Unsupported operation getLocalAddress()
AI-assisted analysis of grpc/grpc-java@64daddc1f3 (2026-09-08).
Data as JSON: /api/errors/06f2d1ba6682d15a.
Report an issue: GitHub.
Appendix: source
Thrown at android/src/main/java/io/grpc/android/UdsSocket.java:245
@Override
public void sendUrgentData(int data) {
throw new UnsupportedOperationException("Unsupported operation sendUrgentData()");
}
@Override
public void setKeepAlive(boolean on) {
throw new UnsupportedOperationException("Unsupported operation setKeepAlive()");
}
@Override
public void setOOBInline(boolean on) {
throw new UnsupportedOperationException("Unsupported operation setOOBInline()");
}
@Override
public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
throw new UnsupportedOperationException("Unsupported operation setPerformancePreferences()");
}
@Override
public void setReceiveBufferSize(int size) throws SocketException {
try {
localSocket.setReceiveBufferSize(size);
} catch (IOException e) {
throw toSocketException(e);
}
}
@Override
public void setReuseAddress(boolean on) {
throw new UnsupportedOperationException("Unsupported operation setReuseAddress()");
}
@Override
public void setSendBufferSize(int size) throws SocketException {View on GitHub (pinned to 64daddc1f3)