Flag trace terminal input anomalies
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
This commit is contained in:
Generated
+1
-1
@@ -436,7 +436,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dosh"
|
name = "dosh"
|
||||||
version = "1.0.0-rc31"
|
version = "1.0.0-rc32"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64",
|
"base64",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dosh"
|
name = "dosh"
|
||||||
version = "1.0.0-rc31"
|
version = "1.0.0-rc32"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
|||||||
+102
-6
@@ -809,6 +809,10 @@ struct TraceReport {
|
|||||||
escape_events: usize,
|
escape_events: usize,
|
||||||
hex_events: usize,
|
hex_events: usize,
|
||||||
stripped_mouse_events: usize,
|
stripped_mouse_events: usize,
|
||||||
|
client_mouseish_sent_events: usize,
|
||||||
|
server_mouseish_pty_write_events: usize,
|
||||||
|
server_rejected_input_events: usize,
|
||||||
|
replay_drop_events: usize,
|
||||||
queued_input_events: usize,
|
queued_input_events: usize,
|
||||||
flushed_input_events: usize,
|
flushed_input_events: usize,
|
||||||
sent_input_events: usize,
|
sent_input_events: usize,
|
||||||
@@ -1159,6 +1163,11 @@ fn summarize_trace_file(path: &Path, tail: usize) -> Result<TraceReport> {
|
|||||||
if event.contains("mouse_stripped") || event == "client.stale_strip" {
|
if event.contains("mouse_stripped") || event == "client.stale_strip" {
|
||||||
report.stripped_mouse_events += 1;
|
report.stripped_mouse_events += 1;
|
||||||
}
|
}
|
||||||
|
if event == "client.input_send"
|
||||||
|
&& summary.get("mouseish").is_some_and(|value| value == "true")
|
||||||
|
{
|
||||||
|
report.client_mouseish_sent_events += 1;
|
||||||
|
}
|
||||||
if event.starts_with("client.queue_") {
|
if event.starts_with("client.queue_") {
|
||||||
report.queued_input_events += 1;
|
report.queued_input_events += 1;
|
||||||
}
|
}
|
||||||
@@ -1170,6 +1179,15 @@ fn summarize_trace_file(path: &Path, tail: usize) -> Result<TraceReport> {
|
|||||||
}
|
}
|
||||||
if event == "server.pty_write" {
|
if event == "server.pty_write" {
|
||||||
report.pty_write_events += 1;
|
report.pty_write_events += 1;
|
||||||
|
if summary.get("mouseish").is_some_and(|value| value == "true") {
|
||||||
|
report.server_mouseish_pty_write_events += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if event == "server.input_rejected_mode" {
|
||||||
|
report.server_rejected_input_events += 1;
|
||||||
|
}
|
||||||
|
if event.contains("replay_drop") {
|
||||||
|
report.replay_drop_events += 1;
|
||||||
}
|
}
|
||||||
if event.contains("reconnect") || event.contains("resume") {
|
if event.contains("reconnect") || event.contains("resume") {
|
||||||
report.reconnect_events += 1;
|
report.reconnect_events += 1;
|
||||||
@@ -1202,15 +1220,19 @@ fn print_trace_report(label: &str, report: &TraceReport) {
|
|||||||
.unwrap_or_else(|| "unknown".to_string())
|
.unwrap_or_else(|| "unknown".to_string())
|
||||||
);
|
);
|
||||||
println!(
|
println!(
|
||||||
" input: sent={} queued={} flushed={} pty_writes={}",
|
" input: sent={} queued={} flushed={} pty_writes={} rejected={} replay_drops={}",
|
||||||
report.sent_input_events,
|
report.sent_input_events,
|
||||||
report.queued_input_events,
|
report.queued_input_events,
|
||||||
report.flushed_input_events,
|
report.flushed_input_events,
|
||||||
report.pty_write_events
|
report.pty_write_events,
|
||||||
|
report.server_rejected_input_events,
|
||||||
|
report.replay_drop_events
|
||||||
);
|
);
|
||||||
println!(
|
println!(
|
||||||
" terminal: mouseish={} stripped={} focus={} esc={} hex={}",
|
" terminal: mouseish={} client_mouse_sent={} server_mouse_pty={} stripped={} focus={} esc={} hex={}",
|
||||||
report.mouseish_events,
|
report.mouseish_events,
|
||||||
|
report.client_mouseish_sent_events,
|
||||||
|
report.server_mouseish_pty_write_events,
|
||||||
report.stripped_mouse_events,
|
report.stripped_mouse_events,
|
||||||
report.focus_events,
|
report.focus_events,
|
||||||
report.escape_events,
|
report.escape_events,
|
||||||
@@ -1220,6 +1242,9 @@ fn print_trace_report(label: &str, report: &TraceReport) {
|
|||||||
" reconnect: events={} roam={}",
|
" reconnect: events={} roam={}",
|
||||||
report.reconnect_events, report.roam_events
|
report.reconnect_events, report.roam_events
|
||||||
);
|
);
|
||||||
|
for warning in trace_report_warnings(report) {
|
||||||
|
println!(" alert: {warning}");
|
||||||
|
}
|
||||||
if !report.events.is_empty() {
|
if !report.events.is_empty() {
|
||||||
println!(" top events:");
|
println!(" top events:");
|
||||||
for (event, count) in top_trace_events(&report.events, 8) {
|
for (event, count) in top_trace_events(&report.events, 8) {
|
||||||
@@ -1234,6 +1259,38 @@ fn print_trace_report(label: &str, report: &TraceReport) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn trace_report_warnings(report: &TraceReport) -> Vec<String> {
|
||||||
|
let mut warnings = Vec::new();
|
||||||
|
if report.server_mouseish_pty_write_events > 0 {
|
||||||
|
warnings.push(format!(
|
||||||
|
"{} mouse-like input event(s) reached the server PTY",
|
||||||
|
report.server_mouseish_pty_write_events
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if report.client_mouseish_sent_events > report.stripped_mouse_events
|
||||||
|
&& report.server_mouseish_pty_write_events == 0
|
||||||
|
{
|
||||||
|
warnings.push(format!(
|
||||||
|
"{} mouse-like input event(s) left the client; check the matching server log",
|
||||||
|
report.client_mouseish_sent_events
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if report.replay_drop_events > 0 {
|
||||||
|
warnings.push(format!(
|
||||||
|
"{} replay/drop event(s) observed",
|
||||||
|
report.replay_drop_events
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if report.reconnect_events > 0
|
||||||
|
&& report.flushed_input_events == 0
|
||||||
|
&& report.queued_input_events > 0
|
||||||
|
{
|
||||||
|
warnings
|
||||||
|
.push("queued input was observed around reconnect without a later flush".to_string());
|
||||||
|
}
|
||||||
|
warnings
|
||||||
|
}
|
||||||
|
|
||||||
fn top_trace_events(events: &BTreeMap<String, usize>, limit: usize) -> Vec<(String, usize)> {
|
fn top_trace_events(events: &BTreeMap<String, usize>, limit: usize) -> Vec<(String, usize)> {
|
||||||
let mut entries: Vec<_> = events
|
let mut entries: Vec<_> = events
|
||||||
.iter()
|
.iter()
|
||||||
@@ -8924,9 +8981,9 @@ mod tests {
|
|||||||
ssh_command_target, ssh_config_uses_proxy, ssh_destination_host, ssh_username,
|
ssh_command_target, ssh_config_uses_proxy, ssh_destination_host, ssh_username,
|
||||||
ssh_with_user, startup_command, status_ssh_target, strip_stale_mouse_reports,
|
ssh_with_user, startup_command, status_ssh_target, strip_stale_mouse_reports,
|
||||||
strip_terminal_focus_reports, summarize_trace_file, terminal_private_mode_transition,
|
strip_terminal_focus_reports, summarize_trace_file, terminal_private_mode_transition,
|
||||||
toml_bare_key_or_quoted, top_trace_events, unix_update_script, update_installer_url,
|
toml_bare_key_or_quoted, top_trace_events, trace_report_warnings, unix_update_script,
|
||||||
update_version_status, upsert_managed_block, valid_forward_host, vscode_safe_alias,
|
update_installer_url, update_version_status, upsert_managed_block, valid_forward_host,
|
||||||
windows_update_script,
|
vscode_safe_alias, windows_update_script,
|
||||||
};
|
};
|
||||||
use dosh::config::{ClientConfig, CommandExtension, HostConfig};
|
use dosh::config::{ClientConfig, CommandExtension, HostConfig};
|
||||||
use dosh::native::EnvVar;
|
use dosh::native::EnvVar;
|
||||||
@@ -10318,11 +10375,50 @@ mod tests {
|
|||||||
assert_eq!(report.queued_input_events, 1);
|
assert_eq!(report.queued_input_events, 1);
|
||||||
assert_eq!(report.sent_input_events, 1);
|
assert_eq!(report.sent_input_events, 1);
|
||||||
assert_eq!(report.reconnect_events, 1);
|
assert_eq!(report.reconnect_events, 1);
|
||||||
|
assert_eq!(report.client_mouseish_sent_events, 0);
|
||||||
|
assert_eq!(report.server_mouseish_pty_write_events, 0);
|
||||||
assert_eq!(report.recent_events.len(), 2);
|
assert_eq!(report.recent_events.len(), 2);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
top_trace_events(&report.events, 1),
|
top_trace_events(&report.events, 1),
|
||||||
vec![("client.input_send".to_string(), 1)]
|
vec![("client.input_send".to_string(), 1)]
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
trace_report_warnings(&report),
|
||||||
|
vec!["queued input was observed around reconnect without a later flush".to_string()]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn trace_report_warns_when_mouse_input_reaches_server_pty() {
|
||||||
|
let dir = tempfile::tempdir().unwrap();
|
||||||
|
let path = dir.path().join("server.log");
|
||||||
|
fs::write(
|
||||||
|
&path,
|
||||||
|
concat!(
|
||||||
|
"ts_ms=30 pid=2 event=server.input_roam session=term from=1.1.1.1:1 to=2.2.2.2:2\n",
|
||||||
|
"ts_ms=31 pid=2 event=server.pty_write session=term seq=9 summary=len=12,esc=false,focus=false,mouseish=true,printable=12\n",
|
||||||
|
"ts_ms=32 pid=2 event=server.input_replay_drop session=term seq=8 summary=len=1,esc=false,focus=false,mouseish=false,printable=1\n",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let report = summarize_trace_file(&path, 10).unwrap();
|
||||||
|
let warnings = trace_report_warnings(&report);
|
||||||
|
|
||||||
|
assert_eq!(report.pty_write_events, 1);
|
||||||
|
assert_eq!(report.server_mouseish_pty_write_events, 1);
|
||||||
|
assert_eq!(report.replay_drop_events, 1);
|
||||||
|
assert_eq!(report.roam_events, 1);
|
||||||
|
assert!(
|
||||||
|
warnings
|
||||||
|
.iter()
|
||||||
|
.any(|warning| { warning == "1 mouse-like input event(s) reached the server PTY" })
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
warnings
|
||||||
|
.iter()
|
||||||
|
.any(|warning| { warning == "1 replay/drop event(s) observed" })
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user