{"record":{"id":"04a532d4a03b21be","repo":"frohoff/ysoserial","slug":"connect-timeout","errorCode":null,"errorMessage":"Connect timeout","messagePattern":"Connect timeout","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"src/main/java/ysoserial/exploit/JBoss.java","lineNumber":263,"sourceCode":"        return chf;\n    }\n\n    private static Channel getChannel ( ConnectionProviderContextImpl context, ConnectionHandler ch, OptionMap options ) throws IOException {\n        Channel c;\n        FutureResult<Channel> chResult = new FutureResult<Channel>(context.getExecutor());\n        ch.open(\"jmx\", chResult, options);\n\n        IoFuture<Channel> cFuture = chResult.getIoFuture();\n        Status s2 = cFuture.await();\n        if ( s2 == Status.FAILED ) {\n            System.err.println(\"Cannot connect\");\n            if ( cFuture.getException() != null ) {\n                throw new IOException(\"Connect failed\", cFuture.getException());\n            }\n        }\n        else if ( s2 != Status.DONE ) {\n            cFuture.cancel();\n            throw new IOException(\"Connect timeout\");\n        }\n\n        c = cFuture.get();\n        return c;\n    }\n\n\n    private static VersionedConnection makeVersionedConnection ( Channel c )\n            throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, MalformedURLException {\n        VersionedConnection vc;\n        Class<?> vcf = Class.forName(\"org.jboss.remotingjmx.VersionedConectionFactory\");\n        Method vcCreate = vcf.getDeclaredMethod(\"createVersionedConnection\", Channel.class, Map.class, JMXServiceURL.class);\n        Reflections.setAccessible(vcCreate);\n        vc = (VersionedConnection) vcCreate.invoke(null, c, new HashMap(), new JMXServiceURL(\"service:jmx:remoting-jmx://\"));\n        return vc;\n    }\n\n","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/frohoff/ysoserial/blob/218bcffcaaa904a4e392f0c15d9e2874533635a3/src/main/java/ysoserial/exploit/JBoss.java#L245-L281","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the port is genuinely open and responsive (nc -vz host port)","Check whether a firewall silently drops packets to that port","Increase the connect await timeout if the network is slow (adjust the await call with a timeout)","Retry the connection; transient congestion can cause timeouts"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify the endpoint responds at all\nProcess p = Runtime.getRuntime().exec(new String[]{\"nc\",\"-z\",\"-w\",\"5\",host,String.valueOf(port)});\nif (p.waitFor() != 0) throw new IllegalStateException(\"port unresponsive\");","typeGuard":null,"tryCatchPattern":"try {\n    Channel c = getChannel(...);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Connect timeout\")) { /* backoff and retry with longer timeout */ }\n}","preventionTips":["Check for silent packet-dropping firewalls (timeouts) vs refused connections","Use generous connect timeouts on slow links","Confirm the target service is up before connecting"],"tags":["java","network","timeout","xnio"],"backgroundTag":"request-timeout","analyzedSha":"218bcffcaaa904a4e392f0c15d9e2874533635a3","analyzedAt":"2026-09-12T01:53:58.488Z","contentChangedAt":"2026-09-12T01:53:58.488Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}