nathanmarz/storm · error · RuntimeException

Client connection should not receive any messages

Error message

Client connection should not receive any messages

What it means

The Netty messaging layer is unidirectional per connection: a Client only sends to a server, it never receives. Client.recv is deliberately implemented as an unconditional throw at Client.java:208 to catch misuse of the connection API.

Solutions

  1. Do not call recv on Client; receive messages on the Server connection instead.
  2. Check the concrete connection type (instanceof Client) before invoking recv in generic IConnection code.
  3. Use a Server (listen on a port) if you need to receive messages.
  4. Rely on the Client's internal async response handling rather than a recv loop.

Example fix

// before
TaskMessage msg = client.recv(0); // always throws
// after
TaskMessage msg = server.recv(0);
Defensive patterns

Strategy: type-guard

Validate before calling

if (conn instanceof backtype.storm.messaging.netty.Client) { /* do not call recv */ }

Type guard

boolean isReceivingConnection(IConnection c) {
    return !(c instanceof backtype.storm.messaging.netty.Client);
}

Try / catch

// recv on Client is guaranteed to throw; guard with instanceof instead of catching

Prevention

When it happens

Trigger: Any direct call to client.recv(flags) on a backtype.storm.messaging.netty.Client instance — typically code written against the IConnection interface treating a client connection like a server connection.

Common situations: Generic code iterating over IConnection objects and calling recv on all of them; testing code that assumes request/response semantics on the netty transport; refactoring server-side read loops into shared client/server utilities.

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 nathanmarz/storm@cdb116e942 (2026-09-12). Data as JSON: /api/errors/0075c040cf405f5a. Report an issue: GitHub.

Appendix: source

Thrown at storm-netty/src/jvm/backtype/storm/messaging/netty/Client.java:208

    }

    /**
     * close_n_release() is invoked after all messages have been sent.
     */
    void  close_n_release() {
        if (channelRef.get() != null)
            channelRef.get().close().awaitUninterruptibly();

        //we need to release resources
        new Thread(new Runnable() {
            @Override
            public void run() {
                factory.releaseExternalResources();
            }}).start();
    }

    public TaskMessage recv(int flags) {
        throw new RuntimeException("Client connection should not receive any messages");
    }

    void setChannel(Channel channel) {
        channelRef.set(channel);
        //reset retries
        if (channel != null)
            retries.set(0);
    }

}




View on GitHub (pinned to cdb116e942)