{"record":{"id":"ed1ee75a401f51ff","repo":"alibaba/canal","slug":"requestget-remote-error-request","errorCode":null,"errorMessage":"requestGet remote error, request : {}","messagePattern":"requestGet remote error, request : (.+?)","errorType":"http","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"instance/manager/src/main/java/com/alibaba/otter/canal/instance/manager/plain/HttpHelper.java","lineNumber":100,"sourceCode":"            if (heads != null) {\n                for (Map.Entry<String, String> entry : heads.entrySet()) {\n                    httpGet.setHeader(entry.getKey(), entry.getValue());\n                }\n            }\n\n            HttpClientContext context = HttpClientContext.create();\n            context.setRequestConfig(config);\n            response = httpclient.execute(httpGet, context);\n            int statusCode = response.getStatusLine().getStatusCode();\n            if (statusCode == HttpStatus.SC_OK) {\n                return EntityUtils.toString(response.getEntity());\n            } else {\n                String errorMsg = EntityUtils.toString(response.getEntity());\n                throw new RuntimeException(\"requestGet remote error, url=\" + uri.toString() + \", code=\" + statusCode\n                                           + \", error msg=\" + errorMsg);\n            }\n        } catch (Throwable t) {\n            throw new RuntimeException(\"requestGet remote error, request : \" + url, t);\n        } finally {\n            if (response != null) {\n                try {\n                    response.close();\n                } catch (IOException e) {\n                    // ignore\n                }\n            }\n            if (httpGet != null) {\n                httpGet.releaseConnection();\n            }\n        }\n    }\n\n    public String post(String url, Map<String, String> heads, Object requestBody, int timeout) {\n        return post0(url, heads, JSON.toJSONString(requestBody), timeout);\n    }\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/instance/manager/src/main/java/com/alibaba/otter/canal/instance/manager/plain/HttpHelper.java#L82-L118","documentation":"Outer catch in HttpHelper.get() (HttpHelper.java:99-100): catches any Throwable from the entire GET flow and rethrows it wrapped in a new RuntimeException 'requestGet remote error, request : <url>' with the original as the cause. This is the exception callers actually observe. It covers: the inner non-200 throw (error 356, preserved as cause), connect failures (unknown host, connection refused), socket/connect/request timeouts from RequestConfig, IllegalArgument/State exceptions from URIBuilder, and NullPointerException if httpclient is null (httpclient is left null when the SSLContext builder in the constructor throws, whose own catch silently ignores the error).","triggerScenarios":"Any failure during HttpHelper.get() — non-200 response, network unreachable, timeout (connect/socket/connection-request all set to `timeout`), malformed URL, or httpclient null due to constructor SSL failure. The outer catch wraps all of them uniformly.","commonSituations":"canal-manager host unreachable / DNS failure; manager down or overloaded; request timeout too low for the manager response; URL misconfigured in canal.properties; httpclient null because SSLContext init failed silently in the constructor (then httpclient.execute throws NPE); network firewall dropping the manager connection.","solutions":["Inspect the cause (getCause()) to classify: ConnectException/UnknownHostException → network/DNS; SocketTimeoutException → raise timeout or fix manager latency; the inner 'requestGet remote error, url=..., code=...' → handle per error 356; NullPointerException → httpclient was not built (constructor SSL init failed) — restart and check HttpClient/SSL dependencies.","Verify the manager URL and that the manager is reachable from the canal node: curl -v <manager-url>.","Increase the timeout passed to get() if the manager is slow.","Ensure the JVM has the crypto libraries needed for SSLContextBuilder in the HttpHelper constructor; otherwise httpclient stays null and every call NPEs.","Add monitoring/alerting on this RuntimeException to catch manager connectivity loss early."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate manager reachability and that httpclient was built (constructor SSL init can leave it null)\nif (helper == null) throw new IllegalStateException(\"HttpHelper not initialized\");\ntry (java.net.Socket s = new java.net.Socket()) {\n    s.connect(new InetSocketAddress(new URL(managerBaseUrl).getHost(),\n              new URL(managerBaseUrl).getPort() > 0 ? new URL(managerBaseUrl).getPort() : 80), 3000);\n} catch (Exception e) {\n    throw new IllegalStateException(\"manager host unreachable: \" + managerBaseUrl, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    String body = helper.get(url, heads, timeout);\n} catch (RuntimeException e) {\n    Throwable c = e.getCause();\n    if (c instanceof java.net.SocketTimeoutException) {\n        log.warn(\"manager GET timeout to {} (timeout={}ms) — raise timeout or check manager load\", url, timeout);\n    } else if (c != null && c.getMessage() != null && c.getMessage().contains(\"code=\")) {\n        log.error(\"manager GET non-200: {}\", c.getMessage()); // see error 356\n    } else if (c instanceof NullPointerException) {\n        log.error(\"httpclient was null — HttpHelper constructor SSL init failed; restart and verify crypto deps\");\n    } else {\n        log.error(\"manager GET failed to {}\", url, e);\n    }\n    throw e;\n}","preventionTips":["Monitor this RuntimeException as the manager-connectivity signal.","Size the `timeout` arg above the manager's worst-case response latency.","Ensure the JVM crypto libs are present so HttpHelper's SSLContext init succeeds (otherwise httpclient stays null and every call NPEs).","Keep manager base URL/credentials correct in canal.properties; pre-flight at startup."],"tags":["http","manager-client","rest","runtime-exception","network","timeout","error-wrapping"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}