tabby-rdp 0.6.0-rc.2 → 0.6.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0-rc.3
4
+
5
+ **Added**
6
+ - A PDU trace for diagnosing picture problems (issue #115): while the diagnostic log is on, each desktop also writes
7
+ `<log name>.otlp.json`, an OpenTelemetry trace of every RDP PDU that passed the plugin's proxy (X.224, MCS, share
8
+ control and data, fast-path updates, the static channels, and inside drdynvc the display control and graphics
9
+ pipeline commands, ZGFX-decompressed), with what this side did with them (H.264 access units handed to the browser's
10
+ decoder and their latency, the canvas resized and drawn, resize requests), grouped into spans: the connection, each
11
+ activation, each resize until a frame at the new size is acknowledged, each graphics frame until its acknowledgement,
12
+ each H.264 access unit. Structure and sizes only: no credentials, keystrokes, clipboard or bitmap data. A D3 viewer
13
+ (`tools/pdu-trace/index.html`) lays the flow out in lanes and checks each resize; `tools/pdu-trace/from-log.mjs`
14
+ converts an older debug log. New suites: `test/unit/pdu-trace.ts`, `test/unit/zgfx.ts`, `npm test -- pdu-trace`.
15
+ - The same resizes with the FreeRDP client, for comparison: `TRD_TEST_CLIENT=freerdp npm test -- pdu-trace` reads
16
+ the graphics commands from FreeRDP's own log (`tools/pdu-trace/from-freerdp-log.mjs`), which the helper now writes
17
+ when `WLOG_*` is set in Tabby's environment, and `TRD_FREERDP_PIPELINE=1` puts FreeRDP on the graphics pipeline
18
+ for Windows desktops too (it uses bitmaps there otherwise).
19
+ - `npm test -- fps`: frame pacing under motion (testufo.com in Edge on a Windows desktop): the server's frame rate,
20
+ the client's, and with IronRDP where each frame's time goes (decoder, canvas, acknowledgement) from the trace.
21
+
22
+ **Fixed**
23
+ - Tearing after a live resize with IronRDP on Windows (issue #115): stale pieces of the old picture, black bars at the
24
+ old edge and a garbled taskbar. The trace shows Windows repainting a resized desktop from the bitmap cache, which
25
+ IronRDP cleared on `ResetGraphics` (IronRDP patch 58, upstream [#2011](https://github.com/Devolutions/IronRDP/pull/2011)),
26
+ and a tile column that its Progressive decoder never painted because the server had moved the tiles to a new codec
27
+ context (patch 59, upstream [#2117](https://github.com/Devolutions/IronRDP/pull/2117)). Six resizes in three runs
28
+ against Windows Server 2025 now settle without any of it; the `pdu-trace` suite checks the flow and the picture.
29
+
3
30
  ## 0.6.0-rc.2
4
31
 
5
32
  **Changed**
@@ -38,6 +38,18 @@ After sleep or a network change the desktop reconnects by itself, with growing p
38
38
 
39
39
  **Sharpness › Retina** renders at your screen's device pixels, with the remote's scale set to match. Video (H.264) is used when the remote sends it: Windows does, GNOME only with a hardware encoder (VA-API or NVENC). **Show connection status** shows the frame rate, the round trip and how the picture comes.
40
40
 
41
+ <a id="performance"></a>
42
+
43
+ ## The picture is slow, or the frame rate is low
44
+
45
+ Start with the server. A Windows session renders at about 30 frames a second by default, and no client shows more than the session renders: open [testufo.com](https://testufo.com) in a browser inside the session and read its own frame-rate readout. To raise the cap, set `DWMFRAMEINTERVAL` (DWORD, 15 for 60 fps) under `HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations` on the server and start a new session. With H.264 on the server (Group Policy "Prioritize H.264/AVC 444 graphics mode for Remote Desktop Connections") IronRDP hands each frame to the browser's hardware decoder, which takes a few milliseconds; without it the server sends ClearCodec and RemoteFX Progressive, which cost more per frame. **Show connection status** (Settings › Remote Desktop) shows the frame rate and the bytes as they arrive. Its frame rate counts server frames for IronRDP and paint batches for FreeRDP, so the two numbers aren't comparable with each other; compare each with the readout inside the session instead. If it still feels slow, the PDU trace (below) shows per frame whether the time goes to the decoder, the canvas or waiting for the server.
46
+
47
+ <a id="trace"></a>
48
+
49
+ ## Reporting a picture problem (tearing, a stale picture after a resize)
50
+
51
+ Turn on **Settings › Remote Desktop › Settings › Diagnostics › Write a log file** (Debug), reproduce the problem, then open the log folder: next to the desktop's `.log` is a `.otlp.json`, the PDU trace: every RDP PDU of the connection with its time, what the browser's H.264 decoder did with each picture, and when the canvas was resized and drawn, grouped by resize and by frame. Open it in the viewer at `tools/pdu-trace/index.html` from the repository (drop the file on it) to see the flow of a resize and the checks on it, and attach it to a report along with the log. Neither file holds passwords, keystrokes, clipboard or picture data; both hold the desktop's name and address. See [tools/pdu-trace/README.md](tools/pdu-trace/README.md).
52
+
41
53
  <a id="sound"></a>
42
54
 
43
55
  ## No sound, or the microphone isn't heard
@@ -53,6 +53,7 @@ const vms_1 = require("./vms");
53
53
  const sessionLog_1 = require("./sessionLog");
54
54
  const updates_1 = require("./updates");
55
55
  const diagnosticLog_1 = require("./diagnosticLog");
56
+ const pduTrace_1 = require("./pduTrace");
56
57
  const hostCompat_1 = require("./hostCompat");
57
58
  const unshowable_1 = require("./unshowable");
58
59
  /**
@@ -238,6 +239,14 @@ class DesktopSession {
238
239
  this.log = new sessionLog_1.SessionLog();
239
240
  /** The log file written for a bug report, while the diagnostic log setting is on (see diagnosticLog.ts). */
240
241
  this.diagnostics = null;
242
+ /** The PDU trace of the connection, while the diagnostic log is on (see pduTrace.ts): written as traceFile. */
243
+ this.trace = null;
244
+ this.traceFile = null;
245
+ /** Where this connection went (host:port), for the trace's resource attributes. */
246
+ this.traceDestination = '';
247
+ /** Stops watching the canvas for the trace. */
248
+ this.traceStop = null;
249
+ this.traceSaving = Promise.resolve();
241
250
  /** What the remote display was last set to. */
242
251
  this.remoteSize = null;
243
252
  this.remote = null;
@@ -507,6 +516,10 @@ class DesktopSession {
507
516
  picture = copy;
508
517
  }
509
518
  });
519
+ clean(() => this.traceStop?.());
520
+ this.traceStop = null;
521
+ this.trace?.local('plugin', 'Connection.Ended');
522
+ clean(() => { void this.saveTrace(); });
510
523
  this.connectionDisposers.splice(0).forEach(clean);
511
524
  clean(() => this.indicator?.setActive(false));
512
525
  clean(() => this.ui?.shutdown());
@@ -561,6 +574,35 @@ class DesktopSession {
561
574
  this.proxy?.close();
562
575
  this.overlay.remove();
563
576
  void this.diagnostics?.close();
577
+ void this.saveTrace();
578
+ }
579
+ /**
580
+ * Writes the PDU trace next to the diagnostic log file, as OTLP/JSON (see PduTrace.toOtlp), for the user alone:
581
+ * at the end of each connection, when the desktop closes, and every two minutes meanwhile (see watchTrace).
582
+ * Writes go one after another.
583
+ */
584
+ saveTrace() {
585
+ const trace = this.trace;
586
+ const file = this.traceFile;
587
+ if (!trace || !file) {
588
+ return Promise.resolve();
589
+ }
590
+ const versions = process.versions;
591
+ const meta = {
592
+ pluginVersion: (0, updates_1.installedVersion)(), desktop: this.spec.name, destination: this.traceDestination, client: this.client ?? '',
593
+ graphics: this.graphics, platform: `${process.platform} ${os.release()}`, electron: versions.electron,
594
+ };
595
+ this.traceSaving = this.traceSaving.then(async () => {
596
+ try {
597
+ const json = JSON.stringify(trace.toOtlp(meta));
598
+ await fs.promises.mkdir(path.dirname(file), { recursive: true, mode: 0o700 });
599
+ await fs.promises.writeFile(file, json, { mode: 0o600 });
600
+ }
601
+ catch (error) {
602
+ this.log.push(`pdu trace: not written: ${error?.message ?? error}`);
603
+ }
604
+ });
605
+ return this.traceSaving;
564
606
  }
565
607
  }
566
608
  exports.DesktopSession = DesktopSession;
@@ -2577,6 +2619,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
2577
2619
  }
2578
2620
  applySize(session, size) {
2579
2621
  session.log.push(`resize: ${size.width}x${size.height} @${size.scale}%`);
2622
+ session.trace?.local('plugin', 'Resize.Requested', { width: size.width, height: size.height, scale: size.scale, mode: this.settingsFor(session).resize });
2580
2623
  const before = session.remoteSize;
2581
2624
  session.remoteSize = size;
2582
2625
  if (session.spec.kind !== 'gnome') {
@@ -3044,6 +3087,35 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3044
3087
  // The status lines carry a stamp of their own already.
3045
3088
  session.log.tee = line => diagnostics.line('plugin', line.replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z /, ''));
3046
3089
  session.log.push(`diagnostics: writing ${diagnostics.file}`);
3090
+ // The PDU trace goes with the log, as OTLP/JSON (see pduTrace.ts and tools/pdu-trace).
3091
+ session.trace = new pduTrace_1.PduTrace();
3092
+ session.traceFile = diagnostics.file.replace(/\.log$/, '') + '.otlp.json';
3093
+ session.log.push(`pdu trace: writing ${session.traceFile}`);
3094
+ }
3095
+ /**
3096
+ * The PDU trace's view of this side while the connection lasts: the canvas (its size and each region drawn),
3097
+ * and a save of the trace every two minutes, so that a crash keeps most of it.
3098
+ */
3099
+ watchTrace(session) {
3100
+ const trace = session.trace;
3101
+ if (!trace) {
3102
+ return;
3103
+ }
3104
+ // IronRDP reveals its canvas asynchronously: look again for a moment.
3105
+ let attempts = 20;
3106
+ const watch = () => {
3107
+ const canvas = session.state === 'connected' ? session.canvas() : null;
3108
+ if (canvas) {
3109
+ session.traceStop?.();
3110
+ session.traceStop = trace.watchCanvas(canvas);
3111
+ }
3112
+ else if (attempts-- > 0) {
3113
+ setTimeout(watch, 100);
3114
+ }
3115
+ };
3116
+ watch();
3117
+ const timer = setInterval(() => { void session.saveTrace(); }, 120_000);
3118
+ session.onConnectionEnd(() => clearInterval(timer));
3047
3119
  }
3048
3120
  /** Where the diagnostic log files go (see diagnosticLog.ts). */
3049
3121
  logFolder() {
@@ -3292,6 +3364,15 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3292
3364
  // certificate authorities (see checkTrusted). One behind an SSH host goes by that host's
3293
3365
  // names, which its certificate can't be checked against: trusted on first use.
3294
3366
  serverName: target.direct ? serverNameOf(asked.host) : undefined,
3367
+ // The PDU trace reads the relayed stream (see pduTrace.ts), while the diagnostic log is on.
3368
+ tap: session.trace ? (direction, data, kind) => {
3369
+ if (kind === 'x224') {
3370
+ session.trace?.x224(direction, data);
3371
+ }
3372
+ else {
3373
+ session.trace?.stream(direction, data);
3374
+ }
3375
+ } : undefined,
3295
3376
  });
3296
3377
  // The desktop was closed while the proxy started: closing it found no proxy, and nothing else would.
3297
3378
  if (!alive()) {
@@ -3927,8 +4008,10 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3927
4008
  const info = await native.connect({
3928
4009
  host: serverNameOf(spec.id === desktops_1.OWN_DESKTOP ? target.hostname ?? target.label : endpoint.host),
3929
4010
  username, password: endpoint.credentials.password, domain, ...size,
3930
- // GNOME requires the pipeline. Windows uses FreeRDP's native bitmap decoder in this first build.
3931
- pipeline: spec.kind === 'gnome',
4011
+ // GNOME requires the pipeline. Windows uses FreeRDP's native bitmap decoder in this first build;
4012
+ // TRD_FREERDP_PIPELINE=1 in Tabby's environment turns the pipeline on there too, for a diagnosis that
4013
+ // compares the two clients on the same path (test/suites/pdu-trace.ts).
4014
+ pipeline: spec.kind === 'gnome' || process.env.TRD_FREERDP_PIPELINE === '1',
3932
4015
  autologon: spec.kind === 'xrdp',
3933
4016
  open: async (abort) => {
3934
4017
  const stream = gateway ? await this.throughGateway(target, spec, session, gateway, endpoint, abort) : await target.openTcp(endpoint.host, endpoint.port);
@@ -3988,6 +4071,8 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3988
4071
  this.watchSize(pane, session);
3989
4072
  session.state = 'connected';
3990
4073
  session.log.push(`connected: ${size.width}x${size.height}`);
4074
+ session.trace?.local('plugin', 'Connected', { width: size.width, height: size.height });
4075
+ this.watchTrace(session);
3991
4076
  session.status('');
3992
4077
  this.tip(pane, session);
3993
4078
  this.labelOnFocus(pane, session);
@@ -4077,11 +4162,12 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
4077
4162
  const [domain, username] = /^([^\\]+)\\(.+)$/.exec(credentials.username)?.slice(1) ?? [endpoint.domain ?? spec.domain ?? '', credentials.username];
4078
4163
  session.status(spec.id === desktops_1.OWN_DESKTOP ? `Connecting to ${target.label}…`
4079
4164
  : target.direct ? `Connecting to ${spec.name}…` : `Connecting to ${spec.name} via ${target.label}…`);
4165
+ // The name the server is signed in to as: the SSH host's for its own desktop, and for its VMs' consoles.
4166
+ session.traceDestination = `${spec.id === desktops_1.OWN_DESKTOP || spec.hyperv ? target.hostname ?? target.label : endpoint.host}:${endpoint.port}`;
4080
4167
  const config = session.ui.configBuilder()
4081
4168
  .withUsername(username)
4082
4169
  .withPassword(credentials.password)
4083
- // The name the server is signed in to as: the SSH host's for its own desktop, and for its VMs' consoles.
4084
- .withDestination(`${spec.id === desktops_1.OWN_DESKTOP || spec.hyperv ? target.hostname ?? target.label : endpoint.host}:${endpoint.port}`)
4170
+ .withDestination(session.traceDestination)
4085
4171
  .withProxyAddress(session.proxy.url)
4086
4172
  .withServerDomain(domain)
4087
4173
  .withAuthToken(session.proxy.token)
@@ -4112,7 +4198,8 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
4112
4198
  // The vendor owns surface retirement and all resource accounting; its public option bounds the
4113
4199
  // browser decoders without wrapping away lifecycle notifications (see h264.ts).
4114
4200
  session.h264 = (0, h264_1.createH264Decoder)(rdp.WebCodecsH264Decoder, { onFailure: (reason) => session.log.push(`h264: failed: ${reason}`) });
4115
- config.withExtension(rdp.h264Decoder(session.h264));
4201
+ // Traced: each access unit handed to the browser's decoder and what came back (see pduTrace.ts).
4202
+ config.withExtension(rdp.h264Decoder(session.trace ? session.trace.wrapH264Decoder(session.h264) : session.h264));
4116
4203
  }
4117
4204
  // GNOME Remote Desktop requires the graphics pipeline. Windows (and xrdp) do better with bitmaps than with
4118
4205
  // the pipeline without H.264; with H.264, Windows streams what changes a lot (video) as video. A build
package/dist/freerdp.js CHANGED
@@ -32,8 +32,11 @@ function freeRDPAuthorities(authorities) {
32
32
  }
33
33
  function helperEnvironment() {
34
34
  // The helper needs OS paths/locale, not the parent app's API keys or the test runner's passwords.
35
+ // WLOG_*: FreeRDP's own logging, for a diagnosis (see tools/pdu-trace/README.md): the helper keeps its log off
36
+ // unless these ask for a channel's log into a file (WLOG_APPENDER=FILE); its console stays the IPC's.
35
37
  const keys = ['PATH', 'HOME', 'USERPROFILE', 'APPDATA', 'LOCALAPPDATA', 'SystemRoot', 'WINDIR', 'TEMP', 'TMP', 'TMPDIR',
36
- 'LANG', 'LC_ALL', 'TZ', 'OPENSSL_CONF'];
38
+ 'LANG', 'LC_ALL', 'TZ', 'OPENSSL_CONF', 'WLOG_FILTER', 'WLOG_APPENDER', 'WLOG_FILEAPPENDER_OUTPUT_FILE_PATH',
39
+ 'WLOG_FILEAPPENDER_OUTPUT_FILE_NAME', 'WLOG_PREFIX'];
37
40
  return { ...Object.fromEntries(keys.filter(key => process.env[key] !== undefined).map(key => [key, process.env[key]])),
38
41
  OPENSSL_MODULES: (0, path_1.dirname)(nativeHelperPath()) };
39
42
  }