Commit 57ba784
committed
fix(io): yield in StreamReader.Read when Ogg page boundary scan does not advance
The Ogg-sync branch in StreamReader.Read called FindNextPageBoundary
and continued unconditionally. When the boundary returned the same
offset (no progress — e.g. transcoder started before the source had
captured Ogg headers, or buffer wraparound mid-page) the loop
hot-spun: ReadAt -> skipped=true -> FindNextPageBoundary -> same
offset -> continue, never yielding to the scheduler.
With a busy auto-transcoder pool (3 source mounts x 3 mp3 bitrates =
9 transcoders, plus 3 manual = 12) every transcoder spun on the
buffer mutex, driving %sy to 73% and the load average above 30 with
near-zero useful work — only 2.4% us.
Yield to the signal-channel select when FindNextPageBoundary cannot
advance; once the source writes more bytes, signal fires and the
read resumes.
Empirically: tinyice CPU dropped from ~100% to ~2.7% on the same box
with the same transcoder count.
Also adds contrib/systemd/tinyice.service — opinionated drop-in unit
with Nice / CPUWeight / sandbox flags + CAP_NET_BIND_SERVICE so a
non-root tinyice user can bind ports 80 / 443.1 parent 73606b6 commit 57ba784
2 files changed
Lines changed: 72 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
115 | 122 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
121 | 131 | | |
122 | 132 | | |
123 | 133 | | |
| |||
0 commit comments