{"record":{"id":"fe653b42b58073d5","repo":"sgl-project/sglang","slug":"engine-info-bootstrap-port-bootstrap-port-is-alr","errorCode":null,"errorMessage":"engine_info_bootstrap_port {bootstrap_port} is already in use. When running multiple instances on the same node, each instance must use a different --engine-info-bootstrap-port.","messagePattern":"engine_info_bootstrap_port (.+?) is already in use\\. When running multiple instances on the same node, each instance must use a different --engine-info-bootstrap-port\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/entrypoints/engine.py","lineNumber":1089,"sourceCode":"        # Nothing below has spawned yet, so a failure here leaves a record the\n        # caller can hand back -- but only once the publication goes with it:\n        # the validation stage writes through late resolution, which refuses a\n        # record that is already published.\n        try:\n            # Allocate ports for inter-process communications\n            if port_args is None:\n                port_args = PortArgs.init_new(server_args)\n            logger.info(f\"server_args={server_args.resolved_dict()}\")\n\n            # Start the engine info bootstrap server if per-rank info is needed.\n            engine_info_bootstrap_server = None\n            if (\n                get_model().remote_instance_weight_loader_start_seed_via_transfer_engine\n                and server_args.node_rank == 0\n            ):\n                bootstrap_port = server_args.engine_info_bootstrap_port\n                if not is_port_available(bootstrap_port):\n                    raise RuntimeError(\n                        f\"engine_info_bootstrap_port {bootstrap_port} is already in use. \"\n                        f\"When running multiple instances on the same node, each instance must use a \"\n                        f\"different --engine-info-bootstrap-port.\"\n                    )\n                engine_info_bootstrap_server = EngineInfoBootstrapServer(\n                    host=server_args.host, port=bootstrap_port\n                )\n\n            # Launch daemons (daemon mode only). The handles travel back to the\n            # Engine that spawned them; shutdown() reaps from there.\n            weight_cache_daemon_procs: List = []\n            if server_args.weight_cache_mode == \"daemon\":\n                weight_cache_daemon_procs = cls._launch_weight_cache_daemons(\n                    server_args\n                )\n        except BaseException:\n            restore_context(context_before_publish)\n            raise","sourceCodeStart":1071,"sourceCodeEnd":1107,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/entrypoints/engine.py#L1071-L1107","documentation":"When the remote-instance weight loader transfer engine is enabled on node_rank 0, the engine starts an EngineInfoBootstrapServer on --engine-info-bootstrap-port. That port must be free; if another process (typically another SGLang instance on the same host) already binds it, startup fails with RuntimeError.","triggerScenarios":"Two or more SGLang instances with remote-instance weight loading running on one node — the second one finds engine_info_bootstrap_port occupied and raises at _launch_subprocesses time.","commonSituations":"Co-located instances for throughput testing; k8s pods sharing host network; a previous instance that didn't fully shut down still holding the port; fixed default port used by all instances.","solutions":["Give each instance a distinct --engine-info-bootstrap-port (e.g. 8100, 8101, ...).","Kill the stale process holding the port (check with ss -ltnp | grep <port>) and relaunch.","If the feature isn't needed for this instance, disable the remote-instance weight loader path so no bootstrap server is started."],"exampleFix":"# before (both instances)\npython -m sglang.launch_server --model ... # same default bootstrap port -> second fails\n\n# after (instance 2)\npython -m sglang.launch_server --model ... --engine-info-bootstrap-port 8102","handlingStrategy":"validation","validationCode":"import socket\ndef port_free(p):\n    s = socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n    try:\n        s.bind((\"0.0.0.0\", p)); return True\n    except OSError:\n        return False\n    finally:\n        s.close()\nassert port_free(engine_info_bootstrap_port)","typeGuard":null,"tryCatchPattern":"try:\n    engine = sgl.Engine(**kwargs)\nexcept RuntimeError as e:\n    if \"engine_info_bootstrap_port\" in str(e):\n        kwargs[\"engine_info_bootstrap_port\"] += 1\n        engine = sgl.Engine(**kwargs)\n    else:\n        raise","preventionTips":["Assign a unique --engine-info-bootstrap-port per co-located instance (port budget per host).","Kill stale instances fully (check ss -ltnp) before relaunching.","In k8s host-network setups, parameterize the port per pod."],"tags":["sglang","port-conflict","multi-instance","startup","bootstrap"],"backgroundTag":"address-in-use","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}