{"record":{"id":"8b29050467141916","repo":"apache/beam","slug":"timeout-waiting-for-the-service-endpoint-geturl-to-startup","errorCode":null,"errorMessage":"Timeout waiting for the service {endpoint.getUrl()} to startup after {System.currentTimeMillis() - start} milliseconds.","messagePattern":"Timeout waiting for the service (.+?) to startup after (.+?) milliseconds\\.","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/ExpansionService.java","lineNumber":97,"sourceCode":"          if (portIndex <= 0) {\n            throw new RuntimeException(\n                \"Expected the endpoint to be of the form <host>:<port> but received \" + url);\n          }\n          int port = Integer.parseInt(url.substring(portIndex + 1));\n          String host = url.substring(0, portIndex);\n          new Socket(host, port).close();\n          // Current service is up. Checking the next one.\n          continue outer;\n        } catch (IOException exn) {\n          try {\n            Thread.sleep(duration);\n          } catch (InterruptedException e) {\n            // Ignore\n          }\n          duration = (long) (duration * 1.2);\n        }\n      }\n      throw new TimeoutException(\n          \"Timeout waiting for the service \"\n              + endpoint.getUrl()\n              + \" to startup after \"\n              + (System.currentTimeMillis() - start)\n              + \" milliseconds.\");\n    }\n  }\n\n  @VisibleForTesting\n  void disableServiceCheck() {\n    disableServiceCheck = true;\n  }\n\n  @Override\n  public void expand(\n      ExpansionApi.ExpansionRequest request,\n      StreamObserver<ExpansionApi.ExpansionResponse> responseObserver) {\n    if (!checkedAllServices) {","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/ExpansionService.java#L79-L115","documentation":"waitForAllServicesToBeReady retries a socket connection to each expansion service endpoint with an increasing backoff (duration *= 1.2) until SERVICE_CHECK_TIMEOUT_MILLIS elapses. If a socket connection never succeeds within that window, it throws this TimeoutException naming the endpoint and elapsed time. The service either is not listening or is unreachable.","triggerScenarios":"Calling expand() or discoverSchemaTransform() while the target expansion service endpoint refuses connections for the entire check window: the service process died, wrong host/port configured, firewall blocking, or the service is still starting after the check timeout.","commonSituations":"Transform service container exited right after launch (port conflict, image error); connecting to the wrong host (e.g. container-internal hostname from the host machine); network policy blocking the port; service slow to boot on a loaded machine.","solutions":["Confirm the service is running and listening: docker compose ps / service ps, then test the port manually (nc -zv host port).","Verify the endpoint host/port pipeline options match the actually started service.","Fix the underlying service startup failure (check its logs) and restart with the launcher's up command.","Check firewall/network policy allows TCP access to the port from your client."],"exampleFix":"// before: endpoint points at a service that never started\n--transformServiceEndpoint=localhost:50051  // nothing listening\n\n// after: start the service first, then connect\nservice.start(); service.waitTillUp(300_000);","handlingStrategy":"retry","validationCode":"// verify reachability before expanding\ntry (Socket s = new Socket()) {\n  s.connect(new InetSocketAddress(host, port), 2000); // throws if refused\n}","typeGuard":null,"tryCatchPattern":"try {\n  expansionService.expand(transform, payload);\n} catch (java.util.concurrent.TimeoutException e) {\n  LOG.error(\"Expansion service {} unreachable: {}\", endpointUrl, e.getMessage());\n  // restart the service, then retry once\n  launcherService.shutdown();\n  launcherService.start();\n  launcherService.waitTillUp(300_000);\n}","preventionTips":["Confirm service uptime (ps command) before submitting pipelines.","Use reachable hostnames (localhost from host, not container-internal names).","Check container logs for silent crashes; keep the check window generous."],"tags":["java","timeout","network","service-startup","connection"],"backgroundTag":"request-timeout","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}