nathanmarz/storm · error · RuntimeException

Server connection should not send any messages

Error message

Server connection should not send any messages

What it means

Like the Client, the messaging layer is unidirectional: a Server only receives from clients and never sends. Server.send is implemented as an unconditional throw at Server.java:135 to catch any attempt to push messages out on a server-side connection.

Solutions

  1. Send only via Client connections; use Server solely for receiving.
  2. In generic IConnection code, branch on instanceof Client before calling send.
  3. Create a Client that connects to the target address if bidirectional communication is needed.

Example fix

// before
server.send(task, bytes); // always throws
// after
client.connect(remoteAddr);
client.send(task, bytes);
Defensive patterns

Strategy: type-guard

Validate before calling

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

Type guard

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

Try / catch

// send on Server is guaranteed to throw; guard with instanceof instead of catching

Prevention

When it happens

Trigger: Any call to server.send(task, message) on a backtype.storm.messaging.netty.Server instance — usually generic IConnection-handling code or tests treating a server like a client.

Common situations: Shared transport abstraction code that sends on every IConnection regardless of direction; worker code accidentally holding the server-side connection and emitting tuples through it; tests exercising send on a listening 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


AI-assisted analysis of nathanmarz/storm@cdb116e942 (2026-09-12). Data as JSON: /api/errors/14bf5409062b356a. Report an issue: GitHub.

Appendix: source

Thrown at storm-netty/src/jvm/backtype/storm/messaging/netty/Server.java:135

     */
    protected void closeChannel(Channel channel) {
        channel.close().awaitUninterruptibly();
        allChannels.remove(channel);
    }

    /**
     * close all channels, and release resources
     */
    public synchronized void close() {
        if (allChannels != null) {  
            allChannels.close().awaitUninterruptibly();
            factory.releaseExternalResources();
            allChannels = null;
        }
    }

    public void send(int task, byte[] message) {
        throw new RuntimeException("Server connection should not send any messages");
    }
}

View on GitHub (pinned to cdb116e942)