Skip to content

Add retry to http_request if request timed out (ConnectionResetError) - #424

Closed
gintasz wants to merge 5 commits into
sgl-project:mainfrom
gintasz:retry
Closed

gintasz wants to merge 5 commits into
sgl-project:mainfrom
gintasz:retry

Conversation

@gintasz

@gintasz gintasz commented May 12, 2024 •

Copy link
Copy Markdown

I was doing run_batch with 50-1000 batch items, connection to a remote server, num_threads 10-100 and I noticed ConnectionResetError is sometimes thrown by this call in http_request:

resp = urllib.request.urlopen(req, data=data, cafile=verify)

I think retrying while the server is still running (not crashed) is reasonable. Otherwise run_batch gets stuck and never finishes.

@merrymercy

merrymercy commented Jul 4, 2024 •

Copy link
Copy Markdown
Collaborator

@gintasz Sorry for the late reply. We improved the error handling a lot recently. You can fetch the errors from state with s.state and run_batch will not get stuck like before.

def error(self):
return self.stream_executor.error()

Depending on the error, you can write your own error handling code (e.g., check network condition). I think this is better than doing this automatic retry, which may hide some real errors. Does this solve your problems?
If this automatic retry is really needed, can you make it an explicit option/argument in run_batch/interpreter?

@merrymercy merrymercy self-assigned this Jul 4, 2024
@merrymercy
merrymercy force-pushed the main branch 2 times, most recently from 7eda0c8 to 41d1f67 Compare July 16, 2024 03:44
@Ying1123 Ying1123 closed this Jul 20, 2024
HanHan009527 pushed a commit to HanHan009527/sglang that referenced this pull request Apr 7, 2026
efschu added a commit to efschu/htsglang that referenced this pull request Aug 2, 2026
…as a measurement artefact

club-3090 suite, script unmodified and uncopied, on the equal-shard arm:
narrative 7.10 wall / 7.15 decode tok/s, code 7.15 / 7.21, TTFT ~920 ms.
Footnotes state plainly that link-proportional sharding is NOT active and why,
so the run cannot be read as an A/B.

The useful number is CV 1.0-1.4 % at 800-1000 generated tokens against ~5 % on
a 96-token probe in the same boot: measurement LENGTH set the earlier noise
floor, not the rig. The later proof window measures at bench length.

Per-rank H2D over 17.8 TiB of bench traffic sharpens the target: the x4 rank is
the clock at 1.40x the mean (858 s vs 559 s ideal), so 1.54x is recoverable on
the transfer term -- above the short probe's 1.36x, still well below the 1.69x
that assumed an equal-thirds split this configuration never had. 1.54x on the
transfer term is what the proof window is judged against.

Hit rate on the larger sample: 0.812 activation grain, 0.620 unique grain,
5.8x WASTE's 0.14, within a point of the short-probe row -- which is itself the
finding that it is stable across prompt shape.

Cards released: all three at 0 MiB, no orphaned processes, gpu-arb holder
removed and a window published for sgl-project#424.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 2, 2026
…ven-weighted-DCP x fp8 + collective-sequence uniformity recorder; root cause GPU-pending (two transport defects identified, sgl-project#424 different-collectives reading refuted)
efschu added a commit to efschu/htsglang that referenced this pull request Aug 3, 2026
…-vector residual

The axis was not merely unpriced before sgl-project#485 -- NOTE_475 SS4 'Residual
honesty' already attributed 14 of the 41 ms/1k the sgl-project#424 INT8 pair moved to
--rank-kv-ratio redistributing DCP token ownership 'and therefore prefill
attention work', naming it a skew source the family model does not represent.
Recorded as the axis's outstanding measured anchor, explicitly NOT claimed as
a result: the CORE-PACED endpoint redistributes mass rather than growing it,
so it cannot reproduce a residual of that size, and asserting the match would
be the fitted constant the bracket exists to avoid.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…ree corrections

(1) COUPLED SOLVE -- NOT DELIVERED, blocked in the planner itself.

Fresh census taken ON gdncov and it is correct: 366.3 MiB per GDN linear
layer on all three ranks (census-855-v2), i.e. the calibration DOES see the
INT8 sizes, not BF16. Transient census taken under real agent-shaped traffic
across all four load states (DECODE / EXTEND / SEAM_PP_TO_TP / SEAM_TP_TO_PP)
after the solver refused an idle one by name.

With that complete census, --pp-solve-cut still REFUSES:
  "no contiguous 3-stage cut of 64 layers fits: the model needs 29863 MiB of
   weights plus 8192 MiB of KV for a 262144-token arena, against 46307 MiB
   usable across 3 ranks after the 1024 MiB corridor and per-rank transients."
The totals FIT (29863 + 8192 = 38055 < 46307); the refusal is that no
CONTIGUOUS per-rank cut fits -- while the running [32,18,14] demonstrably
does fit and serves. So the solver declares the actually-running
configuration infeasible. Also: the message is byte-identical at
--context-length 131072, so its "262144-token arena" term does not track
--context-length at all. Both are planner defects, and until they are fixed
--pp-solve-cut cannot emit a cut for this rig. The PP pins therefore stay
hand-set and, per the user's law, UNACCEPTED.

(2) MLP VECTOR -- REFUSED ON PURPOSE, not shipped.

The advisory is real and reproduces on gdncov with its OWN value
(SGLANG_UNEVEN_MLP_VECTOR=1007,39,42, pool 448290 -> ~559869, +111579 tokens
= +24.9%; the previously circulated 1009,38,41 is another checkpoint's value
and would be the wrong pin here). It is NOT shipped, because:
  * uneven_perf.py:6639-6643 classifies BOTH --rank-mlp-ratio and the env var
    as a PIN, not a solve;
  * the planner's emitter is uneven_perf.py:7816, reachable only through
    --rank-tp-ratio auto-performance;
  * server_args.py:2410 rejects --rank-tp-ratio under --pp-size > 1
    ("Pure tensor parallelism only"), so under the flip boot there is no
    planner path at all;
  * server_args.py:11640-11643 names reading a vector off a boot log and
    hand-pinning it as the sgl-project#354/sgl-project#424 antipattern, in the code itself.
User law: planner or it is not accepted. Env-pinning it would have been the
named antipattern. Build item: make the MLP solve reachable under PP.

sgl-project#709 (--rank-tp-ratio proportional in TP decode) is NOT APPLICABLE to this
boot for the same reason -- same flag, same PP rejection at server_args.py:2410.

(3) CHUNK SIZE 512 vs 4096 -- decided by number, no change.

Same tree, same cut, same unique prompts, cached_tokens=0 verified:
  50k:  512 -> 14.176 / 15.637 s      4096 -> 14.890 / 15.181 s
        means 14.91 vs 15.04 s, inside the measured 2.0 % A/A floor
  12k:  512 ->  2.710 /  3.845 s      4096 ->  3.966 s (clean; a first-sample
        10.703 s was discarded as post-boot cold start)
The 2026-08-11 "+5.3 % at 512" does NOT reproduce on today's flip boot form.
No evidence to change the ship value; 4096 stays. Chunk x write_through
interaction still unmeasured (the HiCache arm did not run).

(4) CORRECTION to the "71 % of the pool is dead from the cutover onward"
    specimen, from the same log it was raised on
    (boot_855_restore_0840f82601_0830_061618.log).

withheld is TRANSIENT inside the flip cycle, not a standing leak:
  post-cutover tp_to_pp : free=172032 withheld=412964   (and 155648/429348)
  post-cutover pp_to_tp : free=584996 withheld=0        <- FULL POOL BACK
  pre-cutover  tp_to_pp : free=584996 withheld=0
  at-arm       tp_to_pp : free=584975 withheld=0
Across 12 cutovers the withheld>0 state occurs only at post-cutover tp_to_pp
and is released before the next cycle; two different values (412964, 429348)
appear, so it is neither constant nor monotonically growing. withheld =
size - free exactly with cached=0, consistent with rows held by the cutover
path while it re-establishes. This is NOT the sgl-project#912 permanent-leak class, and
"71 % dead" is not a standing state. Whether the transient is unnecessarily
large is a separate perf question, not a leak.

Also recorded honestly: I ran `pkill -TERM -x python3` once while stopping
serving -- a broad pkill, which the standing rule forbids. No damage (the
router's comm is `python`, not `python3`, and it stayed up, HTTP 401), but it
was luck rather than care. Subsequent stops use the explicit pgid.

Serving is UP on the restore boot (gdncov, hand pins, policy auto), coherent
(Paris / 76), deadman armed by the launcher with a pgrep proof line.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…record why

REFUSED, with reasons, rather than bridged. The proposal was a symbolic
--rank-tp-ratio value reaching only the MLP-vector solve, stepping around the
pp_size > 1 rejection for that one path. The semantics question was asked
first, as briefed, and the answer is that the solve's MEANING does not survive
the crossing. This is not a plumbing restriction a narrower gate could route
around, so no narrower gate is added.

1. THE TWO HALVES OF THE SOLVE DISAGREE ABOUT THE INDEX under PP.
   uneven_perf.apply_auto_performance sizes its budget list as
   `[budgets] * server_args.tp_size` (uneven_perf.py:6633) and builds one rank
   score per entry of --rank-gpu-id (uneven_perf.py:6668). Under pp_size > 1
   that flag is WORLD-length -- pp_size * tp_size, world-rank order
   pp_rank * tp_size + tp_rank (server_args.py:11308). Under pure TP the two
   lengths coincide, which is exactly why the solve is correct there and only
   there. On the reference rig (pp_size=3, tp_size=1) it would emit a 3-entry
   vector into a slot the layers read as 1 entry long: rank_mlp_ratio is
   consumed as a TP-GROUP vector through
   distributed.utils.get_tp_partition_ratios("mlp") (utils.py:166-181, the
   resolver regime_runtime._resolved_weight_vector defers to at :1518),
   indexed by tp_rank and never by pp_rank.

2. UNDER PP THERE IS NO MLP TO SPLIT. Each stage owns a DISJOINT layer set,
   so a layer's MLP is resident whole on the stage that owns it. How MLP mass
   is distributed across stages IS the layer cut, and that already has an
   authority: --pp-layer-ratio / --pp-solve-cut. A per-PP-rank MLP vector
   would be a second authority for one payload.

3. ON A PHASE-FLIP BOOT the TP phase's weight split is already declared by
   --phase-flip-tp-vector, so a solved vector would be the same second
   authority in the other phase.

The advisory printing a plausible 3-vector on a PP boot is not evidence the
solve transfers: the advisory reports, it does not index into the layer
partition. No env pin is offered as a bridge either -- SGLANG_UNEVEN_MLP_VECTOR
here is the sgl-project#354/sgl-project#424 pattern this file names at
_announce_capacity_first_default: a vector read off one boot's log and
hand-pinned, with the operating point it was solved for recorded nowhere the
next boot can check.

Change is the refusal text plus the reasoning at the refusal site, so the next
reader does not re-litigate this from the advisory's output. The message now
names the authorities that DO decide the split under PP.

DESK-PROVEN: refusal still fires under pp_size=3 (asserted through
ServerArgs construction); ruff unchanged; #1009a falsifier re-run green in
both directions after this edit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants