mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-01 21:45:10 +00:00
Deployed 6e99812e with MkDocs version: 1.6.1
This commit is contained in:
@@ -1856,6 +1856,17 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#client-presence" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Client presence
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
@@ -1889,6 +1900,17 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#when-the-client-ends-a-remote-session" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
When the client ends a remote session
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
@@ -2372,6 +2394,17 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#client-presence" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Client presence
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
@@ -2405,6 +2438,17 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#when-the-client-ends-a-remote-session" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
When the client ends a remote session
|
||||
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
@@ -2656,6 +2700,11 @@ re-parses that instead. The client skips the same DASH periods as the server. An
|
||||
client's local HTTP session. Each cookie in <code>session_cookie_jar</code> keeps its
|
||||
domain, path and <code>secure</code> flag, so it goes only to its own hosts. <code>session_cookies</code> carries
|
||||
the same cookies as names and values only, for older clients.</p>
|
||||
<p>For a music collection (an album, a playlist, an artist listing), the title list reply also
|
||||
has <code>collection</code>, with the facts of the collection itself, such as its kind, title, artist
|
||||
and totals. The client builds its collection with them. It ignores the keys of
|
||||
<code>collection</code> that it does not know, and stops with an error on a value of the wrong type.
|
||||
Without <code>collection</code>, for example from an older server, the client has the songs only.</p>
|
||||
<p>The tracks response repeats the title. A service can rewrite title fields inside
|
||||
<code>get_tracks</code>, so the client takes this copy in place of the one from the title
|
||||
list. Each track carries the full local field set. After the manifest re-parse the
|
||||
@@ -2674,7 +2723,8 @@ and return the content keys directly. See
|
||||
<a href="#the-remote-session-channel">remote session channel</a> keeps the remote session alive,
|
||||
so a long download does not let the remote session expire. On
|
||||
completion, and also when <code>dl</code> exits early (<code>--list</code>, Ctrl+C, an error), it
|
||||
deletes the remote session. If the login belongs to the client, the <code>DELETE</code>
|
||||
deletes the remote session (see <a href="#when-the-client-ends-a-remote-session">When the client ends a remote session</a>).
|
||||
If the login belongs to the client, the <code>DELETE</code>
|
||||
request returns the updated cache files (for example a refreshed token) and the
|
||||
client saves them locally, so the <strong>next</strong> remote session can skip interactive
|
||||
authentication. The login belongs to the client when it succeeds and the
|
||||
@@ -2813,7 +2863,7 @@ vault first. A track that no server vault holds goes back to your device. See
|
||||
</div>
|
||||
<hr />
|
||||
<h2 id="remote-session-lifecycle-and-expiry">Remote session lifecycle and expiry<a class="headerlink" href="#remote-session-lifecycle-and-expiry" title="Permanent link">¶</a></h2>
|
||||
<p>Remote sessions live in an <strong>in-memory store on the server</strong> and expire on a timer. You
|
||||
<p>Remote sessions live in an <strong>in-memory store on the server</strong>. They expire on a timer, or when their client is gone. You
|
||||
generally never touch this directly, but it explains behaviour you might observe.</p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -2827,7 +2877,12 @@ generally never touch this directly, but it explains behaviour you might observe
|
||||
<tr>
|
||||
<td>Idle session TTL</td>
|
||||
<td><strong>300s</strong> (5 min) default</td>
|
||||
<td>Refreshed on every request to the session and when a <code>titles</code> or <code>tracks</code> request ends. A remote session does not expire while a request works on it or while its remote session channel is open</td>
|
||||
<td>Refreshed on every request to the session and when a <code>titles</code> or <code>tracks</code> request ends. A remote session does not reach this limit while a request works on it or while its remote session channel is open</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Client presence</td>
|
||||
<td><strong>180s</strong>, <strong>150s</strong> or <strong>90s</strong></td>
|
||||
<td>The time that a client can be silent after it lost its channel, after <code>create</code>, or after it closed its channel. See <a href="#client-presence">Client presence</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Max concurrent sessions</td>
|
||||
@@ -2837,11 +2892,11 @@ generally never touch this directly, but it explains behaviour you might observe
|
||||
<tr>
|
||||
<td>Auth/input timeout</td>
|
||||
<td><strong>600s</strong> (10 min)</td>
|
||||
<td>A remote session that still logs in, a prompt included, can stay idle for the larger of the TTL and this value</td>
|
||||
<td>A remote session that still logs in, a prompt included, can stay idle for the larger of the TTL and this value, unless its client is gone</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cleanup sweep</td>
|
||||
<td>every 60s</td>
|
||||
<td>every 5s</td>
|
||||
<td>Expired sessions are removed and their input prompts cancelled</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -2850,7 +2905,8 @@ generally never touch this directly, but it explains behaviour you might observe
|
||||
<p class="admonition-title">Auth is never rushed</p>
|
||||
<p>A remote session that is still <code>authenticating</code> or waiting on <code>pending_input</code> can stay
|
||||
idle for the larger of <code>session_ttl</code> and 600s. This gives you time to enter an interactive
|
||||
code without the remote session vanishing mid-prompt.</p>
|
||||
code without the remote session vanishing mid-prompt. The client must stay: it keeps its
|
||||
channel open, or it polls.</p>
|
||||
</div>
|
||||
<p>The TTL and max-session limits are read from server config:</p>
|
||||
<div class="language-yaml highlight"><span class="filename">unshackle.yaml (server)</span><pre><span></span><code><span id="__span-6-1"><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a><span class="nt">serve</span><span class="p">:</span>
|
||||
@@ -3002,7 +3058,9 @@ from a browser origin, not when you want only the local HTTP API.</p>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3 id="create-request-and-response">Create: request and response<a class="headerlink" href="#create-request-and-response" title="Permanent link">¶</a></h3>
|
||||
<p><code>POST /api/session/create</code> requires <code>service</code> and <code>title_id</code>. It also accepts
|
||||
<p><code>POST /api/session/create</code> requires <code>service</code> and <code>title_id</code>. It also accepts <code>session_id</code> (the ID of the remote session,
|
||||
as the canonical text of a version 4 UUID; a create of the same API key and IP with the same ID replaces that remote
|
||||
session when the new one is stored, and the server answers the ID of another API key or IP with <code>403 FORBIDDEN</code>),
|
||||
<code>credentials</code>, <code>cookies</code> (base64 of zlib-compressed Netscape cookie file), <code>proxy</code>,
|
||||
<code>no_proxy</code>, <code>profile</code>, <code>cache</code> (a map of <code>filename → base64(zlib(bytes))</code>),
|
||||
<code>client_region</code>, <code>server_cdm</code> (<code>false</code> when the user picked the local CDM), <code>cdm_type</code>, <code>cdm_security_level</code>, <code>cdm_relay</code> (<code>true</code> when the client
|
||||
@@ -3059,7 +3117,7 @@ layer.</p>
|
||||
fails then, because no client is listening. A fetched call waits 60 seconds for its answer.
|
||||
The call leaves the auth status as it was. An answer never marks the remote session as client-authenticated.</li>
|
||||
<li><code>AUTH_INPUT_TIMEOUT = 600.0</code> seconds. An <code>AUTHENTICATING</code> remote session expires in the store after
|
||||
the larger of <code>session_ttl</code> and this value. A remote session that waits on a prompt stays <code>AUTHENTICATING</code>.</li>
|
||||
the larger of <code>session_ttl</code> and this value, or when its client is gone. A remote session that waits on a prompt stays <code>AUTHENTICATING</code>.</li>
|
||||
</ul>
|
||||
<p><code>GET /api/session/{id}/prompt</code> returns one of:</p>
|
||||
<div class="language-json highlight"><pre><span></span><code><span id="__span-8-1"><a id="__codelineno-8-1" name="__codelineno-8-1" href="#__codelineno-8-1"></a><span class="p">{</span><span class="w"> </span><span class="nt">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"authenticated"</span><span class="w"> </span><span class="p">}</span>
|
||||
@@ -3154,22 +3212,38 @@ request finds the remote session gone.</p>
|
||||
<li><strong>Config-driven limits.</strong> <code>serve.session_ttl</code> (default <code>300</code>) and
|
||||
<code>serve.max_sessions</code> (default <code>100</code>) are read as properties, so config changes
|
||||
take effect without recreating the store.</li>
|
||||
<li><strong><code>creating()</code></strong> holds the ID of a remote session while its <code>create</code> handler works, and refuses an ID that another API
|
||||
key or IP has. <strong><code>end_pending()</code></strong> ends such a create for a <code>DELETE</code>, and then <code>create()</code> stores nothing.</li>
|
||||
<li><strong><code>create()</code></strong> evicts the least-recently-accessed remote session of the API key that holds the most when at capacity,
|
||||
then stores a complete <code>SessionEntry</code> from the fields of the <code>create</code> handler and publishes the <code>create</code> event.</li>
|
||||
<li><strong>Expiry.</strong> <code>get()</code> and <code>cleanup_expired()</code> use one rule. A remote session that no request holds
|
||||
expires when it is idle for longer than <code>ttl</code>. While its login runs (<code>AUTHENTICATING</code>), the limit is
|
||||
<li><strong>Expiry.</strong> <code>get()</code> and <code>cleanup_expired()</code> use one rule. A remote session expires when its client is gone
|
||||
(<a href="#client-presence">Client presence</a>), also while a request holds it. A remote session that no request holds
|
||||
also expires when it is idle for longer than <code>ttl</code>. While its login runs (<code>AUTHENTICATING</code>), the limit is
|
||||
the larger of <code>ttl</code> and <code>AUTH_INPUT_TIMEOUT</code>.</li>
|
||||
<li><strong><code>get()</code></strong> refreshes <code>last_accessed</code> through <code>touch()</code>. It returns <code>None</code> and
|
||||
<li><strong><code>get()</code></strong> refreshes <code>last_accessed</code> and <code>idle_since</code> through <code>touch()</code>. It returns <code>None</code> and
|
||||
deletes the entry when the remote session has expired.</li>
|
||||
<li><strong><code>cleanup_expired()</code></strong> runs every 60s and removes each expired remote session.</li>
|
||||
<li><strong><code>cleanup_expired()</code></strong> runs every 5s and removes each expired remote session.</li>
|
||||
<li><strong>Removal.</strong> Eviction, expiry and <code>delete()</code> end the remote session the same way: they cancel its
|
||||
<code>InputBridge</code>, close its channel, send the <code>delete</code> dashboard event, schedule a staged service reload
|
||||
and delete its cache directory (pruning empty parent dirs up to, but not including, the cache root).</li>
|
||||
<li><strong><code>track_login(task)</code></strong> keeps each login task of <code>session/create</code> until it ends.</li>
|
||||
<li>The server calls <strong><code>close()</code></strong> on shutdown. It ends each open remote session, which
|
||||
unblocks any waiting auth threads, and deletes the cache directory of each one. It sends no dashboard event
|
||||
and schedules no reload. It then waits up to 5 seconds for each login that still runs, and stops the sweep.
|
||||
A login that ends after the shutdown deletes its cache directory again.</li>
|
||||
and delete its cache directory (pruning empty parent dirs up to, but not including, the cache root). A request
|
||||
that waits for the remote session then answers <code>SESSION_NOT_FOUND</code> and starts no service code. So does a request
|
||||
whose service code waits on the client for a prompt or a CDM call, whatever that code does next. A service thread
|
||||
that runs can still write to the cache directory, so a task deletes the directory again after the last request.</li>
|
||||
<li><strong><code>track_login(task)</code></strong> keeps each login task of <code>session/create</code>, and each task that deletes a cache directory
|
||||
again, until it ends.</li>
|
||||
<li><strong>Shutdown.</strong> First, <code>close_channels()</code> cancels each <code>InputBridge</code> and closes each channel, so no request waits
|
||||
for a client while the server waits for its requests. Then the server calls <strong><code>close()</code></strong>. It ends each open
|
||||
remote session and deletes the cache directory of each one. It sends no dashboard event
|
||||
and schedules no reload. It then waits up to 5 seconds for each tracked task that still runs, and stops the sweep.
|
||||
Within that time, a login that ends deletes its cache directory again.</li>
|
||||
<li><strong>Relay.</strong> A server that relays to a <code>remote_services</code> server runs <strong><code>end_remote_pool()</code></strong> after <code>close_channels()</code>.
|
||||
It starts the end of each remote login that waits, and of all idle pooled remote sessions at the same time. A list
|
||||
call whose login it ends, or whose login comes later, gets <code>SERVER_DRAINING</code>. A request in flight finishes first. Every
|
||||
5 seconds until it has stopped, the server ends each request that opens its lost remote session again. Then
|
||||
<strong><code>close_remote_pool()</code></strong> ends the rest and waits up to 5 seconds for each <code>DELETE</code> request. The exit of the process
|
||||
waits for an end that still runs.</li>
|
||||
<li><strong>Signals.</strong> The first <code>SIGTERM</code> starts the shutdown, and the server ignores each later one. A second Ctrl+C forces
|
||||
the end. On Windows only Ctrl+C starts the shutdown.</li>
|
||||
</ul>
|
||||
<p><code>SessionEntry</code> fields:</p>
|
||||
<table>
|
||||
@@ -3182,7 +3256,7 @@ request finds the remote session gone.</p>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>session_id</code></td>
|
||||
<td>UUID4 string</td>
|
||||
<td>UUID4 string: the one of the create request, else one that the server makes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>service_tag</code></td>
|
||||
@@ -3217,15 +3291,75 @@ request finds the remote session gone.</p>
|
||||
<td>Current <code>AuthStatus</code>, read from <code>input_bridge</code> (<code>AUTHENTICATED</code> without one), and last error message</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>presence</code></td>
|
||||
<td><code>ClientPresence</code>: the state of the client and its last sign of life</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>created_at</code> / <code>last_accessed</code></td>
|
||||
<td>Timestamps; <code>last_accessed</code> drives TTL and LRU eviction</td>
|
||||
<td>Timestamps; <code>last_accessed</code> drives LRU eviction</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>idle_since</code></td>
|
||||
<td>Monotonic time of the last access; it drives the TTL, so a step of the system clock expires no remote session</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3 id="client-presence">Client presence<a class="headerlink" href="#client-presence" title="Permanent link">¶</a></h3>
|
||||
<p>Source: <code>unshackle/core/api/client_presence.py</code>. The server knows a client by its channel, its requests and its
|
||||
<code>create</code>. Each state has a limit for the silence of the client. At the limit, the server ends the remote session.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>State</th>
|
||||
<th>When</th>
|
||||
<th>Limit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>awaited</td>
|
||||
<td>The client gave the remote session its ID in <code>create</code>, and has sent no request and opened no channel since</td>
|
||||
<td>150s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>polling</td>
|
||||
<td>The client has had no channel</td>
|
||||
<td>The TTL rule only</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>present</td>
|
||||
<td>The channel is open</td>
|
||||
<td>None</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>away</td>
|
||||
<td>The channel closed with any code except 1000, the connection broke, or the server closed the channel</td>
|
||||
<td>180s, or half of <code>session_ttl</code> when that is more</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>left</td>
|
||||
<td>The client closed the channel with code 1000</td>
|
||||
<td>90s</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<ul>
|
||||
<li><strong>Sign of life.</strong> A request of the client for the remote session, or a new channel, starts the time again. The end
|
||||
of a request does not. A request after the state left makes the state away.</li>
|
||||
<li><strong>Work in progress.</strong> A request that still works for the client does not keep the remote session past the limit.</li>
|
||||
<li><strong>Login.</strong> A client that is away or left does not get the 600s of a login. Its login ends with the remote session.</li>
|
||||
<li><strong>TTL.</strong> The limit never makes a remote session stay for longer than the TTL rule lets it.</li>
|
||||
<li><strong>The <code>DELETE</code>.</strong> The client closes its channel and then sends the <code>DELETE</code>, whose answer has the login cache.
|
||||
Thus the close does not end the remote session at once.</li>
|
||||
<li><strong>A silent loss.</strong> A client that the network cuts off sends no close. The server sends a ping after 20s without
|
||||
data, and counts the client as away when no answer comes in 10s.</li>
|
||||
</ul>
|
||||
<h3 id="per-session-cache-namespacing">Per-session cache namespacing<a class="headerlink" href="#per-session-cache-namespacing" title="Permanent link">¶</a></h3>
|
||||
<p>The <code>create</code> handler builds a <code>Cacher</code> namespaced as:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code><span id="__span-9-1"><a id="__codelineno-9-1" name="__codelineno-9-1" href="#__codelineno-9-1"></a>_sessions/<pbkdf2_hmac(sha256, X-Secret-Key, "unshackle-session-ns", 100000)[:12]>/<session_id>/<service>
|
||||
<div class="language-text highlight"><pre><span></span><code><span id="__span-9-1"><a id="__codelineno-9-1" name="__codelineno-9-1" href="#__codelineno-9-1"></a>_sessions/<pbkdf2_hmac(sha256, X-Secret-Key, "unshackle-session-ns", 100000)[:12]>/<uuid4>/<service>
|
||||
</span></code></pre></div>
|
||||
<p>The server makes a new UUID for each <code>create</code>, so a <code>create</code> that takes over a session ID never shares a directory
|
||||
with the one before it.</p>
|
||||
<p>The handler writes forwarded <code>cache</code> files into that directory before authentication.
|
||||
On <code>DELETE</code>, when the login belongs to the client (<code>client_auth</code>) and the remote
|
||||
session does not run on the server's device, the handler harvests updated cache files from the whole directory tree (compressing each
|
||||
@@ -3295,12 +3429,14 @@ the error codes and the request and reply shapes that it shares with the server
|
||||
(merging returned <code>session_headers</code>/<code>session_cookie_jar</code>, re-parsing <code>manifests</code>) →
|
||||
get the licence in proxy mode or <code>server_cdm</code> mode → <code>close()</code> (<code>DELETE</code>, saving any returned
|
||||
<code>cache</code>).</li>
|
||||
<li><strong>ID.</strong> The client gives the remote session its ID: a version 4 UUID in the <code>session_id</code> of <code>create</code>. It uses
|
||||
the ID of the reply, so a server that ignores the field also works.</li>
|
||||
<li>
|
||||
<p><strong>Server restarts.</strong> The server keeps remote sessions in memory only, so a restart
|
||||
loses them all. The client recovers in two ways:</p>
|
||||
<ul>
|
||||
<li>A drain announced through <code>draining</code>: the client finishes the current title, then
|
||||
closes its remote session, so the drain can end and the refreshed cache comes back.
|
||||
deletes its remote session, so the drain can end and the refreshed cache comes back.
|
||||
It waits until <code>/api/health</code> reports the restarted server without <code>draining</code>,
|
||||
opens a new remote session, and continues with the next title.</li>
|
||||
<li>A lost remote session (<code>SESSION_NOT_FOUND</code>, a connection error, an answer cut off
|
||||
@@ -3308,13 +3444,14 @@ the error codes and the request and reply shapes that it shares with the server
|
||||
for <code>/api/health</code>, then checks the old remote session. A live remote session takes the
|
||||
call again only after a connection error, because a timed-out call can already have run.
|
||||
A cut-off answer counts as a connection error, so the server can run that call twice. A lost one is replaced: the
|
||||
client opens a new remote session, sends <code>titles</code> and the current title's <code>tracks</code>
|
||||
client deletes the old one when the server did not answer <code>SESSION_NOT_FOUND</code> for the call, and
|
||||
saves the cache that comes back. It then opens a new remote session, sends <code>titles</code> and the current title's <code>tracks</code>
|
||||
again, and then sends the failed call again. A title or track that the new remote session
|
||||
gives another ID keeps its old ID on the client, and the client sends the new ID. The client matches a title by season and episode number, and a track by its
|
||||
attributes.</li>
|
||||
</ul>
|
||||
<p>The client waits up to 30 minutes for the server, which covers a deploy's drain. It
|
||||
stops with an error if the new remote session licenses differently from the old one,
|
||||
<p>The client waits up to 30 minutes for the server, which covers a deploy's drain. A Ctrl+C
|
||||
ends this wait. The client stops with an error if the new remote session licenses differently from the old one,
|
||||
for example after a change to the API key's <code>server_cdm</code> grant. An interactive login
|
||||
asks for its input again.
|
||||
- <strong>Server resolution.</strong> <code>resolve_server()</code> reads <code>config.remote_services.<name></code>
|
||||
@@ -3326,6 +3463,46 @@ asks for its input again.
|
||||
server stops the track download, and the client never keeps every segment in its place.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h3 id="when-the-client-ends-a-remote-session">When the client ends a remote session<a class="headerlink" href="#when-the-client-ends-a-remote-session" title="Permanent link">¶</a></h3>
|
||||
<p>Source: <code>unshackle/core/remote_lifetime.py</code>. One owner holds the remote session, its tunnel and its channel
|
||||
from before the first request until the server answers the <code>DELETE</code>. It closes the channel, sends the <code>DELETE</code>,
|
||||
saves the returned cache and then stops the tunnel. It does so:</p>
|
||||
<ul>
|
||||
<li>when <code>dl</code> has finished every title, before the run post-scripts</li>
|
||||
<li>when the process exits: <code>--list</code>, an error, or Ctrl+C in any step, also before <code>create</code> answers</li>
|
||||
<li>when a signal or a closed console stops the process, or the cancel of a download job stops its worker</li>
|
||||
<li>when the login or any other step of the opening fails, or <code>create</code> times out or its answer is cut off</li>
|
||||
<li>when a serve that relays for a REST client closes its pooled remote session</li>
|
||||
<li>when such a serve stops: each remote login that waits, and all idle pooled remote sessions at the same time</li>
|
||||
</ul>
|
||||
<p>The <code>DELETE</code> has a connect and read timeout of 15s each. The client sends it again only once, when a gateway answers with
|
||||
an error page or asks for the API key in the other header. It does not wait for a rate limit.</p>
|
||||
<p>A Ctrl+C during the downloads cancels the run. The client waits for the download threads and for the content keys that
|
||||
still go to the vaults, and then ends the remote session. The cancel ends each wait of a download thread within 0.5s:
|
||||
the wait for a server that restarts, for a rate limit and for a login. A cancelled thread opens no new remote session,
|
||||
and the client deletes a remote session that a thread opens at that moment. The cancel does not stop a request that the
|
||||
server already has: the client waits for its answer. A failed track is no cancel, so the next title can open
|
||||
a new remote session.</p>
|
||||
<p>While the client ends a remote session, it ignores the first Ctrl+C, so it does not lose the returned cache. The next
|
||||
Ctrl+C stops the wait at once, and the process then waits for no other end. The count of Ctrl+C is one for the process.
|
||||
When the run itself called the end, after the last title, that Ctrl+C also stops the run. On Windows, a Ctrl+C
|
||||
counts when the network read that blocks returns, so the 15s timeout limits the wait. After the end, no thread of the
|
||||
client opens a remote session again.</p>
|
||||
<p><code>SIGHUP</code> (a closed terminal) and <code>SIGTERM</code> stop <code>dl</code>, <code>search</code> and <code>tunnel-test</code> as Ctrl+C does, with an exit code other
|
||||
than 0. Three things are different:</p>
|
||||
<ul>
|
||||
<li>The <code>DELETE</code> goes first: before the wait for the download threads, for a CDM call and for the channel.</li>
|
||||
<li>The process ends 8s after the first signal at the latest, also when the server does not answer.</li>
|
||||
<li>A later signal changes nothing, and Ctrl+C keeps its own count.</li>
|
||||
</ul>
|
||||
<p>After <code>SIGHUP</code> the process writes nothing more to a terminal. A redirected output gets each line. <code>nohup</code> keeps its effect.
|
||||
Source: <code>unshackle/core/process_exit.py</code>.</p>
|
||||
<p>On Windows, a closed console window and Ctrl+Break send the <code>DELETE</code> and then end the process, without the rest of the
|
||||
Ctrl+C steps. The system gives a closed window about 5s. A kill (<code>SIGKILL</code>, a Windows task end, the cancel of a download
|
||||
job on Windows) sends no <code>DELETE</code>, so only the server ends the remote session, at its own limits.</p>
|
||||
<p>A cancelled job that uses a remote server sends the <code>DELETE</code> for at most 4s, then its worker ends.</p>
|
||||
<p>The <code>DELETE</code> can arrive while the server still works on <code>create</code>. The server then answers <code>200</code> with no cache, and
|
||||
the <code>create</code> makes no remote session, starts no login and answers <code>404 SESSION_NOT_FOUND</code>.</p>
|
||||
<hr />
|
||||
<h2 id="troubleshooting">Troubleshooting<a class="headerlink" href="#troubleshooting" title="Permanent link">¶</a></h2>
|
||||
<div class="admonition example">
|
||||
|
||||
Reference in New Issue
Block a user