frohoff/ysoserial · error · IOException

Connect timeout

Error message

Connect timeout

What it means

In JBoss.getChannel, if the awaited IoFuture status is neither FAILED nor DONE, the code cancels the future and throws IOException("Connect timeout"). This means the connection attempt did not complete within the await window.

Solutions

  1. Confirm the port is genuinely open and responsive (nc -vz host port)
  2. Check whether a firewall silently drops packets to that port
  3. Increase the connect await timeout if the network is slow (adjust the await call with a timeout)
  4. Retry the connection; transient congestion can cause timeouts
Defensive patterns

Strategy: retry

Validate before calling

// verify the endpoint responds at all
Process p = Runtime.getRuntime().exec(new String[]{"nc","-z","-w","5",host,String.valueOf(port)});
if (p.waitFor() != 0) throw new IllegalStateException("port unresponsive");

Try / catch

try {
    Channel c = getChannel(...);
} catch (IOException e) {
    if (e.getMessage().contains("Connect timeout")) { /* backoff and retry with longer timeout */ }
}

Prevention

When it happens

Trigger: cFuture.await() returns a status other than DONE or FAILED — i.e. WAITING — when the remote endpoint accepts no response within the timeout, e.g. a filtered/firewalled port that silently drops SYN packets.

Common situations: Firewalled targets that drop rather than reject traffic, wrong port pointing at a non-responsive service, or saturated network. Distinct from 'Connect failed' which implies an explicit failure/refusal.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of frohoff/ysoserial@218bcffcaa (2026-09-12). Data as JSON: /api/errors/04a532d4a03b21be. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/ysoserial/exploit/JBoss.java:263

        return chf;
    }

    private static Channel getChannel ( ConnectionProviderContextImpl context, ConnectionHandler ch, OptionMap options ) throws IOException {
        Channel c;
        FutureResult<Channel> chResult = new FutureResult<Channel>(context.getExecutor());
        ch.open("jmx", chResult, options);

        IoFuture<Channel> cFuture = chResult.getIoFuture();
        Status s2 = cFuture.await();
        if ( s2 == Status.FAILED ) {
            System.err.println("Cannot connect");
            if ( cFuture.getException() != null ) {
                throw new IOException("Connect failed", cFuture.getException());
            }
        }
        else if ( s2 != Status.DONE ) {
            cFuture.cancel();
            throw new IOException("Connect timeout");
        }

        c = cFuture.get();
        return c;
    }


    private static VersionedConnection makeVersionedConnection ( Channel c )
            throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, MalformedURLException {
        VersionedConnection vc;
        Class<?> vcf = Class.forName("org.jboss.remotingjmx.VersionedConectionFactory");
        Method vcCreate = vcf.getDeclaredMethod("createVersionedConnection", Channel.class, Map.class, JMXServiceURL.class);
        Reflections.setAccessible(vcCreate);
        vc = (VersionedConnection) vcCreate.invoke(null, c, new HashMap(), new JMXServiceURL("service:jmx:remoting-jmx://"));
        return vc;
    }

View on GitHub (pinned to 218bcffcaa)