grpc/grpc-java · info · UnsupportedOperationException

Unsupported operation setOOBInline()

Error message

Unsupported operation setOOBInline()

What it means

Sentinel guard in UdsSocket's Socket adapter: the OOBInline socket option is meaningless for Unix domain sockets, so the setOOBInline override always rejects the call. It fires when socket-configuration code written for TCP tries to enable out-of-band inline reception on this UDS-backed socket.

Solutions

  1. Do not set OOB inline on UDS sockets; it has no meaning without TCP urgent data
  2. Make socket-option appliers type-aware and skip TCP-only options for UdsSocket
  3. Handle UnsupportedOperationException in option-setting loops so one unsupported option doesn't abort channel setup

Example fix

// before
socket.setOOBInline(true);
// after
try {
  socket.setOOBInline(true);
} catch (UnsupportedOperationException e) {
  // option not applicable to this socket type (e.g. UDS)
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean supportsOobInline = !(socket instanceof io.grpc.android.UdsSocket);

Type guard

static boolean supportsTcpOnlyOption(java.net.Socket s) { return !(s instanceof io.grpc.android.UdsSocket); }

Try / catch

try { socket.setOOBInline(on); } catch (UnsupportedOperationException e) { /* skip on UDS */ }

Prevention

When it happens

Trigger: Calling UdsSocket.setOOBInline(boolean) directly, or bulk socket-option setup routines that apply every standard Socket option regardless of transport.

Common situations: Generic socket-hardening checklists applied to all sockets in an Android app; shared network-layer code reused between TCP and UDS gRPC channels.

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


AI-assisted analysis of grpc/grpc-java@64daddc1f3 (2026-09-08). Data as JSON: /api/errors/46c370488aa10959. Report an issue: GitHub.

Appendix: source

Thrown at android/src/main/java/io/grpc/android/UdsSocket.java:240

  @Override
  public synchronized boolean isOutputShutdown() {
    return outputShutdown;
  }

  @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) {

View on GitHub (pinned to 64daddc1f3)