Commit 4d9eeb9
committed
ws-over-h2: don't conflate nwsi buffered output with the stream's parked frames
The tx flow-control parking introduced in 57effc6 gates the park, drain
and re-arm logic on lws_has_buffered_out(), which for an h2 stream also
reports the NETWORK wsi's buflist_out -- the buffer that fills whenever
lws_issue_raw() takes a partial socket write. The drain logic, however,
assumes the predicate describes the stream's OWN parked frames, which
breaks four ways under ordinary socket-level backpressure:
- lws_h2_ws_drain_parked_tx(): after the stream's last parked frame is
consumed, a partial write left by its own lws_issue_raw(nwsi) keeps
the while (lws_has_buffered_out(wsi)) loop alive via the nwsi branch;
the next iteration reads the empty stream buflist and returns -1,
and rops_perform_user_POLLOUT_h2() closes a healthy stream that had
just flushed everything it owned.
- rops_perform_user_POLLOUT_h2(): the post-drain re-arm is skipped
whenever the nwsi still holds a partial, on the assumption that a
WINDOW_UPDATE will re-arm the child. When the peer's window is
large (tx credit ample, bottleneck is the socket) no WINDOW_UPDATE
is coming, requested_POLLOUT was already consumed, and the pending-
writable accounting then drops POLLOUT on the connection: the user
callback never fires again and the transfer stalls permanently.
- the same gate pulls a SIBLING ws stream -- nothing of its own parked,
POLLOUT requested -- into the drain once an earlier child's drain
congests the nwsi in the same service pass, hitting the identical
empty-buflist close.
- lws_h2_frame_write(): the parking predicate fires on nwsi congestion
caused by another stream, needlessly deferring fully-credited frames
into the drain path instead of letting lws_issue_raw(nwsi) append
them in order.
Test the stream's own buflist_out directly in all four places, and let
a carries-ws child with nothing of its own parked fall through to
normal servicing. The existing api-test doesn't catch these because
its drip-fed WINDOW_UPDATEs continually re-arm every child and
localhost doesn't produce partial writes.1 parent f3a9f48 commit 4d9eeb9
2 files changed
Lines changed: 24 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
709 | | - | |
| 709 | + | |
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
| |||
768 | 768 | | |
769 | 769 | | |
770 | 770 | | |
771 | | - | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
772 | 778 | | |
773 | 779 | | |
774 | 780 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1089 | 1089 | | |
1090 | 1090 | | |
1091 | 1091 | | |
1092 | | - | |
1093 | 1092 | | |
1094 | | - | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
1098 | | - | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1099 | 1106 | | |
1100 | 1107 | | |
1101 | 1108 | | |
| |||
1105 | 1112 | | |
1106 | 1113 | | |
1107 | 1114 | | |
1108 | | - | |
| 1115 | + | |
1109 | 1116 | | |
1110 | 1117 | | |
1111 | 1118 | | |
| |||
1115 | 1122 | | |
1116 | 1123 | | |
1117 | 1124 | | |
| 1125 | + | |
1118 | 1126 | | |
| 1127 | + | |
1119 | 1128 | | |
1120 | 1129 | | |
1121 | 1130 | | |
| |||
0 commit comments