An embedsports stream's session expires when it is not polled, so a restart drops the game #136

Closed
opened 2026-11-09 23:45:02 -05:00 by cmoriarty · 7 comments
Owner

Streams read from the embedsports.me player (s2watch.cyou, suksukstreams.cfd; PR #133) are tied to a session that the stream server ends when nobody polls the playlist for a while.

Seen 2026-11-10

  • 01:17:59Z: Georgia vs. FGCU found on suksukstreams.cfd; its background channel played it, Healthy.
  • 01:27:34Z: the app stopped for a deploy; back at 01:28:08Z.
  • 01:28:21Z: the restored entry's re-check failed, "manifest: upstream error: 401", 47 s after the stop. The game left Ready.
  • It had not been found again four minutes later, when the session that watched it ended.

A scratch test the same night had the playlist still answering re-checks 100 s after the page was closed, but there the re-checks themselves were polling it.

To find out

  • How long a session lasts unpolled (somewhere under 47 s).
  • Whether a Ready game with no channel loses its link between re-checks: they run every 3 minutes, far longer than that.
  • How long the game takes to come back after the 401.

Ideas

  • Treat a 401 on a restored entry's confirming re-check as "read the link again now", ahead of the queue.
  • Poll a kept link of this kind often enough to keep its session, or do not count it Ready without a channel.

Done when a restart, and three idle minutes, no longer cost a game on this player its Ready state.

Streams read from the embedsports.me player (s2watch.cyou, suksukstreams.cfd; PR #133) are tied to a session that the stream server ends when nobody polls the playlist for a while. **Seen 2026-11-10** - 01:17:59Z: Georgia vs. FGCU found on suksukstreams.cfd; its background channel played it, Healthy. - 01:27:34Z: the app stopped for a deploy; back at 01:28:08Z. - 01:28:21Z: the restored entry's re-check failed, "manifest: upstream error: 401", 47 s after the stop. The game left Ready. - It had not been found again four minutes later, when the session that watched it ended. A scratch test the same night had the playlist still answering re-checks 100 s after the page was closed, but there the re-checks themselves were polling it. **To find out** - How long a session lasts unpolled (somewhere under 47 s). - Whether a Ready game with no channel loses its link between re-checks: they run every 3 minutes, far longer than that. - How long the game takes to come back after the 401. **Ideas** - Treat a 401 on a restored entry's confirming re-check as "read the link again now", ahead of the queue. - Poll a kept link of this kind often enough to keep its session, or do not count it Ready without a channel. **Done when** a restart, and three idle minutes, no longer cost a game on this player its Ready state.
Author
Owner

Not fixed: no embedsports stream was live while the batch was built (04:45 to 05:15Z; the late games' s2watch and suksukstreams links used other players), so nothing could be measured.

More evidence from the evening (production events, 01:27 to 03:14Z)

  • A playing channel on this stream failed 10 times with "the playlist failed to load 2 times; last error: playlist: upstream error: 401", 2 to 7 minutes after it landed. So the session ends while it is being polled, not only when it is idle.
  • LSU vs. Louisiana Tech: tuned suksukstreams 01:42:03, 401 at 01:43:59; moved to suksukstreams 02:15:42, 401 at 02:17:19; a standby was read on suksukstreams at 03:02:03, and the channel's 401 came at 03:03:15.
  • The stream's addresses carry a stamp about two hours ahead (.../1794279842/..., ssid=sv2.1794279849...), so the 401s are not that expiry.

Two explanations, neither tested

  1. A second session on the same stream from the same address ends the first. Each standby search that reads the other front end opens one. The LSU times fit; Georgia vs. FGCU played 4 minutes after a second read, which fits less well. #139 makes the app treat the two front ends as one stream, which should cut these reads, but a search with nothing else to read still opens the copy.
  2. The session simply lasts a few minutes, and the site's own player starts again when it ends.

To settle it, with an embedsports game live (men's college basketball evenings), run from the repository root:
CLOUDFLARE_SOLVER_URL=http://192.168.1.115:8191 DATA_DIR=<a scratch folder> PYTHONPATH=backend backend/.venv/bin/python session_two.py 90 480
It polls one session like a channel, opens a second on the same stream after 90 s, and reports which is refused, when, and whether the first address (play.m3u8) gives a fresh playlist afterwards. The script is in the session's scratch folder and is pasted below in the next comment if it is wanted in the repo.

Likely fix either way: when the playlist answers 401, ask the link's first address again for a fresh one and play on (the renewal path of #73), before any swap. That needs the measurement first.

Not fixed: no embedsports stream was live while the batch was built (04:45 to 05:15Z; the late games' s2watch and suksukstreams links used other players), so nothing could be measured. **More evidence from the evening** (production events, 01:27 to 03:14Z) - A playing channel on this stream failed 10 times with "the playlist failed to load 2 times; last error: playlist: upstream error: 401", 2 to 7 minutes after it landed. So the session ends while it is being polled, not only when it is idle. - LSU vs. Louisiana Tech: tuned suksukstreams 01:42:03, 401 at 01:43:59; moved to suksukstreams 02:15:42, 401 at 02:17:19; a standby was read on suksukstreams at 03:02:03, and the channel's 401 came at 03:03:15. - The stream's addresses carry a stamp about two hours ahead (`.../1794279842/...`, `ssid=sv2.1794279849...`), so the 401s are not that expiry. **Two explanations, neither tested** 1. A second session on the same stream from the same address ends the first. Each standby search that reads the other front end opens one. The LSU times fit; Georgia vs. FGCU played 4 minutes after a second read, which fits less well. #139 makes the app treat the two front ends as one stream, which should cut these reads, but a search with nothing else to read still opens the copy. 2. The session simply lasts a few minutes, and the site's own player starts again when it ends. **To settle it**, with an embedsports game live (men's college basketball evenings), run from the repository root: `CLOUDFLARE_SOLVER_URL=http://192.168.1.115:8191 DATA_DIR=<a scratch folder> PYTHONPATH=backend backend/.venv/bin/python session_two.py 90 480` It polls one session like a channel, opens a second on the same stream after 90 s, and reports which is refused, when, and whether the first address (`play.m3u8`) gives a fresh playlist afterwards. The script is in the session's scratch folder and is pasted below in the next comment if it is wanted in the repo. **Likely fix either way:** when the playlist answers 401, ask the link's first address again for a fresh one and play on (the renewal path of #73), before any swap. That needs the measurement first.
Author
Owner

session_two.py, the probe named above:

"""Embedsports sessions: poll session A like a channel, open session B on the same stream after a while,
and see which is refused, when, and whether A's first address gives a fresh playlist."""
import asyncio, json, logging, sys, time, urllib.request
logging.basicConfig(level=logging.WARNING)
from app import upstream, verify
from app.resolver import browser, player, solver, sportsurge

SECOND_AFTER = float(sys.argv[1]) if len(sys.argv) > 1 else 90
LIMIT = float(sys.argv[2]) if len(sys.argv) > 2 else 420
t0 = time.time()
say = lambda *a: print(f"{time.time()-t0:6.0f}s", *a, flush=True)


async def state(url, referer):
    try:
        await upstream.fetch_manifest(url, referer)
        return "200"
    except upstream.UpstreamError as exc:
        return exc.reason


async def main():
    with urllib.request.urlopen("http://192.168.1.115:7000/api/games", timeout=15) as r:
        d = json.load(r)
    games = d if isinstance(d, list) else d["games"]
    found = []
    for game in [g for g in games if g["status"] == "live" and any(s["kind"] == "sportsurge" for s in g["sources"])]:
        try:
            cands = await sportsurge.SportsurgeAdapter().candidates(game)
        except Exception as exc:
            continue
        found = []
        for c in cands:
            if c.host in ("s2watch.cyou", "suksukstreams.cfd"):
                try:
                    ref = await player.read_player_page(c.url, timeout=20, reader=browser.read_stream_from_page)
                except Exception as exc:
                    say(game["matchup"], c.host, "read failed:", exc); continue
                say(game["matchup"], c.host, "->", ref.url[:90])
                if "play.m3u8" in ref.url:
                    found.append((c, ref))
                    break
        if found:
            break
    if not found:
        say("no embedsports stream live"); return
    cand, ref = found[0]
    referer = ref.headers.get("Referer")
    v = await verify.verify(ref)
    say("A ref     :", ref.url[:200]); say("A playlist:", v.playlist_url[:200])
    last = None; opened_b = False; vb = None
    while time.time() - t0 < LIMIT:
        s = await state(v.playlist_url, referer)
        if s != last:
            say("A playlist:", s); last = s
        if vb is not None:
            sb = await state(vb.playlist_url, referer)
            if sb != "200":
                say("B playlist:", sb)
        if s != "200":
            say("A first address again:", end=" ")
            try:
                media, final = await verify._media_playlist(ref.url, referer)
                print("200 ->", final[:150], "| same address" if final == v.playlist_url else "| a new address", flush=True)
            except Exception as exc:
                print(getattr(exc, "reason", exc), flush=True)
            break
        if not opened_b and time.time() - t0 > SECOND_AFTER:
            opened_b = True
            try:
                ref_b = await player.read_player_page(cand.url, timeout=20, reader=browser.read_stream_from_page)
                vb = await verify.verify(ref_b)
                say("B opened  :", vb.playlist_url[:200])
            except Exception as exc:
                say("B failed:", getattr(exc, "reason", exc))
        await asyncio.sleep(2)
    say("stopped")
    await solver.close_sessions()
    await (await browser.get_browser_handle()).close()

asyncio.run(main())
`session_two.py`, the probe named above: ```python """Embedsports sessions: poll session A like a channel, open session B on the same stream after a while, and see which is refused, when, and whether A's first address gives a fresh playlist.""" import asyncio, json, logging, sys, time, urllib.request logging.basicConfig(level=logging.WARNING) from app import upstream, verify from app.resolver import browser, player, solver, sportsurge SECOND_AFTER = float(sys.argv[1]) if len(sys.argv) > 1 else 90 LIMIT = float(sys.argv[2]) if len(sys.argv) > 2 else 420 t0 = time.time() say = lambda *a: print(f"{time.time()-t0:6.0f}s", *a, flush=True) async def state(url, referer): try: await upstream.fetch_manifest(url, referer) return "200" except upstream.UpstreamError as exc: return exc.reason async def main(): with urllib.request.urlopen("http://192.168.1.115:7000/api/games", timeout=15) as r: d = json.load(r) games = d if isinstance(d, list) else d["games"] found = [] for game in [g for g in games if g["status"] == "live" and any(s["kind"] == "sportsurge" for s in g["sources"])]: try: cands = await sportsurge.SportsurgeAdapter().candidates(game) except Exception as exc: continue found = [] for c in cands: if c.host in ("s2watch.cyou", "suksukstreams.cfd"): try: ref = await player.read_player_page(c.url, timeout=20, reader=browser.read_stream_from_page) except Exception as exc: say(game["matchup"], c.host, "read failed:", exc); continue say(game["matchup"], c.host, "->", ref.url[:90]) if "play.m3u8" in ref.url: found.append((c, ref)) break if found: break if not found: say("no embedsports stream live"); return cand, ref = found[0] referer = ref.headers.get("Referer") v = await verify.verify(ref) say("A ref :", ref.url[:200]); say("A playlist:", v.playlist_url[:200]) last = None; opened_b = False; vb = None while time.time() - t0 < LIMIT: s = await state(v.playlist_url, referer) if s != last: say("A playlist:", s); last = s if vb is not None: sb = await state(vb.playlist_url, referer) if sb != "200": say("B playlist:", sb) if s != "200": say("A first address again:", end=" ") try: media, final = await verify._media_playlist(ref.url, referer) print("200 ->", final[:150], "| same address" if final == v.playlist_url else "| a new address", flush=True) except Exception as exc: print(getattr(exc, "reason", exc), flush=True) break if not opened_b and time.time() - t0 > SECOND_AFTER: opened_b = True try: ref_b = await player.read_player_page(cand.url, timeout=20, reader=browser.read_stream_from_page) vb = await verify.verify(ref_b) say("B opened :", vb.playlist_url[:200]) except Exception as exc: say("B failed:", getattr(exc, "reason", exc)) await asyncio.sleep(2) say("stopped") await solver.close_sessions() await (await browser.get_browser_handle()).close() asyncio.run(main()) ```
Author
Owner

More evidence, 2026-11-14 (production on 3a94153; from the game's events and a recorder that read /api/channels every 2 s from 18:08Z to 18:48Z)

Penn vs. Harvard, a background channel nobody watched, on this stream through s2watch.cyou and suksukstreams.cfd:

Tuned On Ended Lasted How it ended
18:12:22Z s2watch.cyou 18:22:15Z 9 min 53 s "the playlist failed to load 2 times; last error: playlist: upstream error: 401"; recovered on the standby suksukstreams.cfd, and that channel closed 75 s later
18:25:16Z s2watch.cyou 18:34:39Z 9 min 23 s closed (nobody watching, no standby)
18:35:53Z suksukstreams.cfd 18:44:48Z 8 min 55 s closed; its standby, on the same site, had gone 22 s earlier
18:46:26Z s2watch.cyou still open when the recorder stopped

What it adds:

  • The session ended three times running after 9 to 10 minutes of steady polling, so it is not only a matter of minutes 2 to 7.
  • The second and third ends came within a minute of a check verifying the same stream through the other front end (suksukstreams.cfd at 18:34:43Z, s2watch.cyou at 18:45:32Z). The first has no such check in the events; the nearest was 7 minutes before.
  • From 18:35:54Z the channel's standby was a link on the site it was already playing, so two sessions on one stream were held on purpose.
  • The three other channels open at the time, on thetvapp.plus and app.my1click.top, played the whole 40 minutes without a change.

Each end closes the background channel, and it comes back one to two minutes later when a check finds the stream again. A viewer on this game would have had a failure about every ten minutes.

**More evidence, 2026-11-14** (production on 3a94153; from the game's events and a recorder that read `/api/channels` every 2 s from 18:08Z to 18:48Z) Penn vs. Harvard, a background channel nobody watched, on this stream through s2watch.cyou and suksukstreams.cfd: | Tuned | On | Ended | Lasted | How it ended | | --- | --- | --- | --- | --- | | 18:12:22Z | s2watch.cyou | 18:22:15Z | 9 min 53 s | "the playlist failed to load 2 times; last error: playlist: upstream error: 401"; recovered on the standby suksukstreams.cfd, and that channel closed 75 s later | | 18:25:16Z | s2watch.cyou | 18:34:39Z | 9 min 23 s | closed (nobody watching, no standby) | | 18:35:53Z | suksukstreams.cfd | 18:44:48Z | 8 min 55 s | closed; its standby, on the same site, had gone 22 s earlier | | 18:46:26Z | s2watch.cyou | | | still open when the recorder stopped | What it adds: - The session ended three times running after 9 to 10 minutes of steady polling, so it is not only a matter of minutes 2 to 7. - The second and third ends came within a minute of a check verifying the same stream through the other front end (suksukstreams.cfd at 18:34:43Z, s2watch.cyou at 18:45:32Z). The first has no such check in the events; the nearest was 7 minutes before. - From 18:35:54Z the channel's standby was a link on the site it was already playing, so two sessions on one stream were held on purpose. - The three other channels open at the time, on thetvapp.plus and app.my1click.top, played the whole 40 minutes without a change. Each end closes the background channel, and it comes back one to two minutes later when a check finds the stream again. A viewer on this game would have had a failure about every ten minutes.
Author
Owner

Cause found, 2026-11-14. Measured on production (3a94153) with a recorder on /api/channels and the readiness file, the container log, and probes and page traces run from a second address.

What ends the session

The embedsports player's page is given a session of ten minutes, and the page keeps it alive. The app never did.

  • Before the page asks for its stream it asks a key service, seckyes.cc, for a session. The answer says valid_until (ten minutes on) and refresh_after: 300.
  • The stream writes that end on its key line: #EXT-X-KEY … URI="https://seckyes.cc/<id>/<uuid>?…&exp=<valid_until>". At that second the stream hosts answer 401 with the header x-seckey-reason: expired to the playlist, to segments already listed and to the link's first address (play.m3u8).
  • Every five minutes the page asks the key service again, with the scode, ts, device id and session id of its last answer and r=1. Each answer moves the end ten minutes on. The site's own player played past ten minutes that way in three traces.
  • The app closes a player page as soon as it has seen the stream, so nothing sent that request, and every link on this player died ten minutes after its page was read.

Evidence

Production, the playing link of each channel on this player between 20:11Z and 21:14Z. The issue time is the stamp in the link's first address (ssid=sv2.<stamp>) less two hours; the refusal is the second the channel's first reload failed.

Game Site Stream host Page issued its session Playlist first refused After
South Carolina vs. Gardner-Webb givemestreams.cfd s-c4.ragice.autos 20:11:41Z 20:21:39 to 20:21:40Z 599 to 600 s
Penn vs. Harvard s2watch.cyou s-c10.mhys.ink 20:12:58Z 20:22:56 to 20:22:57Z 598 to 599 s
Penn vs. Harvard suksukstreams.cfd s-c6.rusfish.space 20:21:55Z 20:31:55 to 20:31:56Z 600 to 601 s
Miami vs. Duke my1click.top s-b2.rusfish.space 20:24:19Z 20:34:19 to 20:34:20Z 600 to 601 s
Penn vs. Harvard s2watch.cyou s-b3.owledge.cc 20:31:06Z 20:41:03 to 20:41:04Z 598 to 599 s
Penn vs. Harvard suksukstreams.cfd s-c9.owledge.cc 20:32:26Z 20:42:24 to 20:42:25Z 598 to 599 s
South Carolina vs. Gardner-Webb givemestreams.cfd s-c6.owledge.cc 20:36:31Z 20:46:30 to 20:46:31Z 600 to 601 s
Gonzaga vs. LSU resports.cfd s-b2.owledge.cc 20:49:39Z 20:59:37 to 20:59:38Z 598 to 599 s
Penn vs. Harvard s2watch.cyou s-b1.ragice.autos 20:51:47Z 21:01:46 to 21:01:47Z 600 to 601 s
Penn vs. Harvard suksukstreams.cfd s-c6.ragice.autos 20:53:45Z 21:03:41 to 21:03:42Z 596 to 597 s
Penn vs. North Carolina hadcrak.cyou s-c4.owledge.cc 21:03:13Z 21:13:11 to 21:13:12Z 598 to 599 s
  • All 19 failures of Penn vs. Harvard's channel in the container log (18:22Z to 21:04Z, 11 closes) read "the playlist failed to load 2 times; last error: playlist: upstream error: 401", and so do all 31 failures of any channel on this player's stream hosts. So the later ends say the same as the first.
  • The ten minutes count from the page read, not from the verification: in the first two rows the link was verified 48 s and 43 s after its page was read.
  • A probe with the app's reader and client (page read 20:24:48Z, exp 20:34:47Z): a playlist polled every 2 s was refused at 20:34:47Z. A second playlist from the same first address, polled five times in ten minutes, was refused in the same poll. The first address asked again was refused too.

What it is not

  • Not a session that is not polled: the idle one lasted exactly as long. The 401 of 2026-11-10 at 47 s after a restart was a session then ten minutes old.
  • Not a second session on the same stream: two from one page lasted to the same second, and production's standby and playing sessions overlapped all afternoon.
  • Not the stamp in the address (ssid=sv2.<stamp>): that one is two hours ahead, as comment 8134 said. It is when the page's token expires.

The app can send the renewal

Sent with the app's own client and the page closed, the renewal was accepted (HTTP 200, valid_until ten minutes on), twice, and the playlist was still answering 736 s after the page read, 138 s past its first end (20:43Z to 20:55Z). Every value it carries is handed out by the key service's last answer.

What each end cost

  • The channel closed (nobody watching, no standby), or a viewer would have had filler.
  • The link was cooled as failed and its stream remembered as left, which holds back its copies on the other sites.
  • The game left Ready, so the sixth-ranked followed game took its place among the five background channels, and lost it when the stream was found again. North Florida vs. The Citadel's channel was opened and closed six times between 19:06Z and 20:14Z, each close in the second another game was "kept warm" again (Penn vs. Harvard five times, South Carolina vs. Gardner-Webb once). Confirmed in background.sync.
  • A standby verified ten minutes before was taken by a recovery and failed two seconds later (19:06:14Z).

The change (OpenSpec sessions-kept-alive; written in a work tree, not committed)

  • The reader keeps the session grant with the stream, and the app sends the renewal every five minutes for every link it keeps (resolver/seckey.py, keepalive.py; LINK_KEEPALIVE_ENABLED=0 turns it off). Such a link is read again only when the key service says it must be, about two hours on.
  • If the renewal is refused, or switched off, the link's end is read from the playlist's key line and its page is read again with half its life left: first for the link a channel plays, with a round's spare read otherwise.
  • A link past its own end is dropped without a cooldown or a mark, and is never taken as a standby. A channel whose link ends anyway reads the same link again and stays open, and its game keeps its place.
  • A renewed link on another host of the player carries on by its segments' names: no splice, nothing played twice.

Checked against live streams, from a second address (not production)

  • The app's reader kept the grant on s2watch.cyou, suksukstreams.cfd and resports.cfd, and the verification read the session's end from the key line, to the second the grant's valid_until (printed for the first two).
  • The app's keep-alive renewed a kept link twice, and its playlist was still answering 76 s past the end it was read with (Gonzaga vs. LSU on suksukstreams.cfd, 21:16Z to 21:28Z).
  • A real channel, run in-process on resports.cfd with the keep-alive loop beside it, played through its first end (21:30:26Z) with no failed reload, swap or filler: 222 segments in 11 minutes, read 58 s past the end.
  • Lanes: openspec validate sessions-kept-alive --strict valid; make test 1367 passed, 1 skipped; npm --prefix frontend test 265 passed; make e2e passed.

Not known

  • What the key service answers after reauthorize_at (115 minutes after the page read). The app reads the page again five minutes before it. A probe is running past that mark tonight.
  • Whether production's address (the VPN's) is renewed like the one the probes ran from. The page's own renewals come from the same address as its grant, so it should be; the first deploy will show it (each channel's link.session in /api/channels, and one "kept alive" line per link in the log).
  • Nothing above ran in production: the change is not deployed.

The details and the file formats are in docs/stream-sources.md (section 2026-11-14) of the change.

**Cause found, 2026-11-14.** Measured on production (3a94153) with a recorder on `/api/channels` and the readiness file, the container log, and probes and page traces run from a second address. **What ends the session** The embedsports player's page is given a session of ten minutes, and the page keeps it alive. The app never did. - Before the page asks for its stream it asks a key service, `seckyes.cc`, for a session. The answer says `valid_until` (ten minutes on) and `refresh_after: 300`. - The stream writes that end on its key line: `#EXT-X-KEY … URI="https://seckyes.cc/<id>/<uuid>?…&exp=<valid_until>"`. At that second the stream hosts answer 401 with the header `x-seckey-reason: expired` to the playlist, to segments already listed and to the link's first address (`play.m3u8`). - Every five minutes the page asks the key service again, with the scode, ts, device id and session id of its last answer and `r=1`. Each answer moves the end ten minutes on. The site's own player played past ten minutes that way in three traces. - The app closes a player page as soon as it has seen the stream, so nothing sent that request, and every link on this player died ten minutes after its page was read. **Evidence** Production, the playing link of each channel on this player between 20:11Z and 21:14Z. The issue time is the stamp in the link's first address (`ssid=sv2.<stamp>`) less two hours; the refusal is the second the channel's first reload failed. | Game | Site | Stream host | Page issued its session | Playlist first refused | After | | --- | --- | --- | --- | --- | --- | | South Carolina vs. Gardner-Webb | givemestreams.cfd | s-c4.ragice.autos | 20:11:41Z | 20:21:39 to 20:21:40Z | 599 to 600 s | | Penn vs. Harvard | s2watch.cyou | s-c10.mhys.ink | 20:12:58Z | 20:22:56 to 20:22:57Z | 598 to 599 s | | Penn vs. Harvard | suksukstreams.cfd | s-c6.rusfish.space | 20:21:55Z | 20:31:55 to 20:31:56Z | 600 to 601 s | | Miami vs. Duke | my1click.top | s-b2.rusfish.space | 20:24:19Z | 20:34:19 to 20:34:20Z | 600 to 601 s | | Penn vs. Harvard | s2watch.cyou | s-b3.owledge.cc | 20:31:06Z | 20:41:03 to 20:41:04Z | 598 to 599 s | | Penn vs. Harvard | suksukstreams.cfd | s-c9.owledge.cc | 20:32:26Z | 20:42:24 to 20:42:25Z | 598 to 599 s | | South Carolina vs. Gardner-Webb | givemestreams.cfd | s-c6.owledge.cc | 20:36:31Z | 20:46:30 to 20:46:31Z | 600 to 601 s | | Gonzaga vs. LSU | resports.cfd | s-b2.owledge.cc | 20:49:39Z | 20:59:37 to 20:59:38Z | 598 to 599 s | | Penn vs. Harvard | s2watch.cyou | s-b1.ragice.autos | 20:51:47Z | 21:01:46 to 21:01:47Z | 600 to 601 s | | Penn vs. Harvard | suksukstreams.cfd | s-c6.ragice.autos | 20:53:45Z | 21:03:41 to 21:03:42Z | 596 to 597 s | | Penn vs. North Carolina | hadcrak.cyou | s-c4.owledge.cc | 21:03:13Z | 21:13:11 to 21:13:12Z | 598 to 599 s | - All 19 failures of Penn vs. Harvard's channel in the container log (18:22Z to 21:04Z, 11 closes) read "the playlist failed to load 2 times; last error: playlist: upstream error: 401", and so do all 31 failures of any channel on this player's stream hosts. So the later ends say the same as the first. - The ten minutes count from the page read, not from the verification: in the first two rows the link was verified 48 s and 43 s after its page was read. - A probe with the app's reader and client (page read 20:24:48Z, `exp` 20:34:47Z): a playlist polled every 2 s was refused at 20:34:47Z. A second playlist from the same first address, polled five times in ten minutes, was refused in the same poll. The first address asked again was refused too. **What it is not** - Not a session that is not polled: the idle one lasted exactly as long. The 401 of 2026-11-10 at 47 s after a restart was a session then ten minutes old. - Not a second session on the same stream: two from one page lasted to the same second, and production's standby and playing sessions overlapped all afternoon. - Not the stamp in the address (`ssid=sv2.<stamp>`): that one is two hours ahead, as comment 8134 said. It is when the page's token expires. **The app can send the renewal** Sent with the app's own client and the page closed, the renewal was accepted (HTTP 200, `valid_until` ten minutes on), twice, and the playlist was still answering 736 s after the page read, 138 s past its first end (20:43Z to 20:55Z). Every value it carries is handed out by the key service's last answer. **What each end cost** - The channel closed (nobody watching, no standby), or a viewer would have had filler. - The link was cooled as failed and its stream remembered as left, which holds back its copies on the other sites. - The game left Ready, so the sixth-ranked followed game took its place among the five background channels, and lost it when the stream was found again. North Florida vs. The Citadel's channel was opened and closed six times between 19:06Z and 20:14Z, each close in the second another game was "kept warm" again (Penn vs. Harvard five times, South Carolina vs. Gardner-Webb once). Confirmed in `background.sync`. - A standby verified ten minutes before was taken by a recovery and failed two seconds later (19:06:14Z). **The change** (OpenSpec `sessions-kept-alive`; written in a work tree, not committed) - The reader keeps the session grant with the stream, and the app sends the renewal every five minutes for every link it keeps (`resolver/seckey.py`, `keepalive.py`; `LINK_KEEPALIVE_ENABLED=0` turns it off). Such a link is read again only when the key service says it must be, about two hours on. - If the renewal is refused, or switched off, the link's end is read from the playlist's key line and its page is read again with half its life left: first for the link a channel plays, with a round's spare read otherwise. - A link past its own end is dropped without a cooldown or a mark, and is never taken as a standby. A channel whose link ends anyway reads the same link again and stays open, and its game keeps its place. - A renewed link on another host of the player carries on by its segments' names: no splice, nothing played twice. **Checked against live streams, from a second address (not production)** - The app's reader kept the grant on s2watch.cyou, suksukstreams.cfd and resports.cfd, and the verification read the session's end from the key line, to the second the grant's `valid_until` (printed for the first two). - The app's keep-alive renewed a kept link twice, and its playlist was still answering 76 s past the end it was read with (Gonzaga vs. LSU on suksukstreams.cfd, 21:16Z to 21:28Z). - A real channel, run in-process on resports.cfd with the keep-alive loop beside it, played through its first end (21:30:26Z) with no failed reload, swap or filler: 222 segments in 11 minutes, read 58 s past the end. - Lanes: `openspec validate sessions-kept-alive --strict` valid; `make test` 1367 passed, 1 skipped; `npm --prefix frontend test` 265 passed; `make e2e` passed. **Not known** - What the key service answers after `reauthorize_at` (115 minutes after the page read). The app reads the page again five minutes before it. A probe is running past that mark tonight. - Whether production's address (the VPN's) is renewed like the one the probes ran from. The page's own renewals come from the same address as its grant, so it should be; the first deploy will show it (each channel's `link.session` in `/api/channels`, and one "kept alive" line per link in the log). - Nothing above ran in production: the change is not deployed. The details and the file formats are in `docs/stream-sources.md` (section 2026-11-14) of the change.
Author
Owner

Addendum, 2026-11-14 23:40Z: the runs that were still going. All from the second address, not production. Nothing is committed or deployed.

What the key service answers after reauthorize_at (was "not known")

One session, renewed every five minutes by the app's client with the page closed, until it was refused (Missouri vs. Georgia on my1click.top, page read 21:16:32Z):

When After the page read What happened
21:21Z to 23:06Z 5 to 110 min 22 renewals accepted, each with refresh_after: 300
23:11:29Z 115 min reauthorize_at
23:11:41Z 115 min renewal accepted: valid_until 23:21:40Z, refresh_after: 289 (the second of csrf_expires_at)
23:16:30Z 120 min renewal refused: 401, x-seckey-reason: reauthorization_required
23:21:19Z and later renewals refused: 401, expired
23:21:39Z 125 min the playlist's first refusal, at its last valid_until: 403
  • A session can be kept alive for two hours from its page read, and its stream plays five minutes more.
  • The change reads the page again five minutes before reauthorize_at, at 110 minutes. That is 15 minutes before the end, with two more renewals still to be accepted, so nothing in the change had to move.
  • If that read fails, the refusal at two hours ends the chain, and the link falls back to the end its session last named, as for any link nothing keeps alive.
  • The end after two hours answered 403, where an ordinary end answers 401. The channel goes by the time the session named, not by the status.

The two runs of the change's own code, finished

  • The keep-alive, 45 minutes (Gonzaga vs. LSU on suksukstreams.cfd, 21:16Z to 22:01Z): eight renewals accepted in a row. The playlist, polled every 2 s, answered every time, to 2098 s past the end it was read with.
  • The channel run in-process on resports.cfd, to its end at 800 s: it played through its first end (21:30:26Z) and 198 s more. State playing, one run, 268 segments, no failed reload, swap, filler or discontinuity.

Still not known

  • Whether production's address (the VPN's) is renewed like this one. The first deploy will show it: each channel's link.session in /api/channels, and one "kept alive" line per link in the log.
**Addendum, 2026-11-14 23:40Z: the runs that were still going.** All from the second address, not production. Nothing is committed or deployed. **What the key service answers after `reauthorize_at`** (was "not known") One session, renewed every five minutes by the app's client with the page closed, until it was refused (Missouri vs. Georgia on my1click.top, page read 21:16:32Z): | When | After the page read | What happened | | --- | --- | --- | | 21:21Z to 23:06Z | 5 to 110 min | 22 renewals accepted, each with `refresh_after: 300` | | 23:11:29Z | 115 min | `reauthorize_at` | | 23:11:41Z | 115 min | renewal accepted: `valid_until` 23:21:40Z, `refresh_after: 289` (the second of `csrf_expires_at`) | | 23:16:30Z | 120 min | renewal refused: 401, `x-seckey-reason: reauthorization_required` | | 23:21:19Z and later | | renewals refused: 401, `expired` | | 23:21:39Z | 125 min | the playlist's first refusal, at its last `valid_until`: 403 | - A session can be kept alive for two hours from its page read, and its stream plays five minutes more. - The change reads the page again five minutes before `reauthorize_at`, at 110 minutes. That is 15 minutes before the end, with two more renewals still to be accepted, so nothing in the change had to move. - If that read fails, the refusal at two hours ends the chain, and the link falls back to the end its session last named, as for any link nothing keeps alive. - The end after two hours answered 403, where an ordinary end answers 401. The channel goes by the time the session named, not by the status. **The two runs of the change's own code, finished** - The keep-alive, 45 minutes (Gonzaga vs. LSU on suksukstreams.cfd, 21:16Z to 22:01Z): eight renewals accepted in a row. The playlist, polled every 2 s, answered every time, to 2098 s past the end it was read with. - The channel run in-process on resports.cfd, to its end at 800 s: it played through its first end (21:30:26Z) and 198 s more. State playing, one run, 268 segments, no failed reload, swap, filler or discontinuity. **Still not known** - Whether production's address (the VPN's) is renewed like this one. The first deploy will show it: each channel's `link.session` in `/api/channels`, and one "kept alive" line per link in the log.
Author
Owner

Merged and deployed, 2026-11-15.

  • Merged as c4962b8 (pull request #166, commit 9a8b5e1) at 00:22:48Z, on the owner's word.
  • The image job on the merge commit succeeded. The app stopped at 00:23:44Z and was up 14 s later, with "9 ready games kept through the restart, 2 too old to keep". /api/version reports c4962b8.
  • Nobody was watching. The five open channels were background ones, and all five were open again 20 s after the restart.

Seen live, 00:24Z to 00:59Z (read only: /api/channels, /api/events and the container log)

  • Production's address is renewed. 14 "kept alive" lines in 35 minutes, on my1click.top (8) and reddittrend.sbs (6), for the streams and standbys of nine games. None refused.
  • A channel plays past ten minutes. Virginia Tech vs. Stanford's channel went onto my1click.top at 00:42Z with a session ending 00:52:00Z. At 00:59Z it had played that one link for 17 minutes: three renewals, no swap, no failed reload, graded Steady.
  • A kept-alive standby holds when it is taken. Bruins vs. Wild's channel recovered at 00:51:04Z onto a my1click.top standby read six minutes before. It played past that link's first end (00:55Z) and was still Steady at 00:59Z, with two renewals.
  • One last end the old way, as expected. Blues vs. Panthers was on a reddittrend.sbs link read before the restart, which carried no session. It failed at 00:29:47Z with the 401. Its standby (s2watch.cyou, another player) then answered 503, so the channel closed and was back at 00:34:02Z on thetvapp.plus. No link read after the restart has answered 401.
  • The log has no error or warning line since the restart.

Seen once, cause not established

  • North Carolina vs. Louisville's background channel moved from thetvapp.plus to "the better stream" on my1click.top at 00:45:37Z and back 17 s later. Nobody was watching. In the 7.5 hours before the deploy there were nine such moves and none was undone.
  • The rule that makes these moves is older than this change and not part of it. What is new is that this player's streams now live long enough to be picked.

Not done

  • The OpenSpec change sessions-kept-alive is not archived.
**Merged and deployed, 2026-11-15.** - Merged as c4962b8 (pull request #166, commit 9a8b5e1) at 00:22:48Z, on the owner's word. - The image job on the merge commit succeeded. The app stopped at 00:23:44Z and was up 14 s later, with "9 ready games kept through the restart, 2 too old to keep". `/api/version` reports c4962b8. - Nobody was watching. The five open channels were background ones, and all five were open again 20 s after the restart. **Seen live, 00:24Z to 00:59Z** (read only: `/api/channels`, `/api/events` and the container log) - **Production's address is renewed.** 14 "kept alive" lines in 35 minutes, on my1click.top (8) and reddittrend.sbs (6), for the streams and standbys of nine games. None refused. - **A channel plays past ten minutes.** Virginia Tech vs. Stanford's channel went onto my1click.top at 00:42Z with a session ending 00:52:00Z. At 00:59Z it had played that one link for 17 minutes: three renewals, no swap, no failed reload, graded Steady. - **A kept-alive standby holds when it is taken.** Bruins vs. Wild's channel recovered at 00:51:04Z onto a my1click.top standby read six minutes before. It played past that link's first end (00:55Z) and was still Steady at 00:59Z, with two renewals. - **One last end the old way, as expected.** Blues vs. Panthers was on a reddittrend.sbs link read before the restart, which carried no session. It failed at 00:29:47Z with the 401. Its standby (s2watch.cyou, another player) then answered 503, so the channel closed and was back at 00:34:02Z on thetvapp.plus. No link read after the restart has answered 401. - The log has no error or warning line since the restart. **Seen once, cause not established** - North Carolina vs. Louisville's background channel moved from thetvapp.plus to "the better stream" on my1click.top at 00:45:37Z and back 17 s later. Nobody was watching. In the 7.5 hours before the deploy there were nine such moves and none was undone. - The rule that makes these moves is older than this change and not part of it. What is new is that this player's streams now live long enough to be picked. **Not done** - The OpenSpec change `sessions-kept-alive` is not archived.
Author
Owner

Archived, and the restart case seen live, 2026-11-15.

  • The OpenSpec change is archived as 27df2a8 on main (openspec/changes/archive/2026-11-14-sessions-kept-alive), on the owner's word. The image job succeeded, and the app restarted at 01:37:01Z and was up 3 s later. Nobody was watching.
  • A restart no longer drops a game on this player. Three background channels were on kept-alive my1click.top links before the restart: Bruins vs. Wild, Blues vs. Panthers and Virginia Tech vs. Stanford. All three came back on the same links with their sessions, at 10, 12 and 10 renewals. Each was renewed again within three and a half minutes and played past the end its session had named before the restart (01:42:31Z and 01:45:28Z), with no swap and no failed reload.
  • Virginia Tech vs. Stanford had by then played one link on this player for 65 minutes, since 00:42Z, through the restart.
  • In the 85 minutes since the first deploy: 16 "kept alive" lines, none refused. The background move that undid itself (above) has not happened again: five such moves, one undone.
**Archived, and the restart case seen live, 2026-11-15.** - The OpenSpec change is archived as 27df2a8 on `main` (`openspec/changes/archive/2026-11-14-sessions-kept-alive`), on the owner's word. The image job succeeded, and the app restarted at 01:37:01Z and was up 3 s later. Nobody was watching. - **A restart no longer drops a game on this player.** Three background channels were on kept-alive my1click.top links before the restart: Bruins vs. Wild, Blues vs. Panthers and Virginia Tech vs. Stanford. All three came back on the same links with their sessions, at 10, 12 and 10 renewals. Each was renewed again within three and a half minutes and played past the end its session had named before the restart (01:42:31Z and 01:45:28Z), with no swap and no failed reload. - Virginia Tech vs. Stanford had by then played one link on this player for 65 minutes, since 00:42Z, through the restart. - In the 85 minutes since the first deploy: 16 "kept alive" lines, none refused. The background move that undid itself (above) has not happened again: five such moves, one undone.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/sports-breaker#136
No description provided.