Files
HellCon/docs/connection-investigation.md
T

101 lines
6.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# First-version comparison
Compared `d198332` (first commit) with `95e4a87` (current checkout), 2026-10-16.
The checkout was clean and did not contain the diagnostics files mentioned in
the handoff. The preview on port 4174 was not running.
The user reports the original version works between two physical machines on
different networks. Earlier successful diagnostic logs were both same-machine
tests. The physical-device regression remains **unexplained**; the experiments
below do not reproduce it and do not establish a firewall, DNS or timing cause.
## Relevant differences
| Area | First version | Current checkout | Finding |
| --- | --- | --- | --- |
| STUN default | Google | PageQuit (introduced in `1d8e595`) | User also observed failure with Google; 701 is not a sufficient explanation. |
| Gathering | Completes immediately when done, otherwise returns partial SDP after 5 s | Requires completion within 30 s (`752d0cf`) | A real behavior change, but reported failed sessions gathered in 0–0.1 s. No evidence this deadline caused those failures. |
| Signaling | Base64 of SDP | Base64 of a versioned JSON envelope (`752d0cf`) | Both use the gathered `localDescription.sdp`, preserve candidates, and apply decoded SDP directly. Neither implements trickle signaling. |
| Failed peer | UI marks closed; peer stays alive | Session disposes failed peer (`752d0cf`) | Tested keeping it alive; did not recover in the controlled Firefox case. No justification yet to treat this as the root cause. |
| Transfer | Sends metadata/file on channel open | Requires fingerprint confirmation and receiver acceptance | These happen after ICE connects. The reported failures are at ICE setup. |
| Lifecycle | Sender was not closed on component unmount | Both roles close when switching Send/Receive | Browser-tab/app switching has no explicit cancellation handler in either version. |
| TURN | None | Explicit opt-in only | Default remains direct; do not assume another application's successful path was direct. |
## Controlled experiment
`scripts/compare-ice.mjs` loads the actual signaling helpers from the first
commit using `git show`, and the current helpers using Node's TypeScript
eraser. It creates independent local peer pairs for three modes: original,
current with the current UI's immediate failed-peer cleanup, and current with
that cleanup disabled. This isolates signaling/lifecycle behavior; it is not a
test of either complete Vue UI and does not simulate a physical network fully.
All modes use identical ICE configuration. The experiment removes TCP offer
candidates and changes advertised UDP ports to port 9, leaving the real sender
socket alive. This deliberately prevents initial checks to the advertised
sender endpoint; a subsequent sender-initiated check can potentially discover
a usable peer-reflexive candidate. The answer is applied after 20 seconds.
Only times/states and receipt of a fixed probe string are reported, never SDP.
Observed results on this host:
| Browser | Original | Current | Current, keep failed peer |
| --- | --- | --- | --- |
| Firefox | Receiver failed at ~5 s; no probe received | Receiver failed at ~5 s; no probe received | Receiver failed at ~5 s; no probe received |
| Chromium | Probe received at ~20.3 s | Probe received at ~20.3 s | Probe received at ~20.3 s |
A further Firefox run configured a silent loopback UDP socket as STUN
(`--slow-stun`). All modes still completed gathering in under 0.1 s and included
the end-of-candidates marker, so this did **not** exercise the partial-gathering
fallback. All failed alike. Do not claim this tested a genuinely slow STUN path.
These results rule out the claim that simply retaining a failed peer fixes this
particular controlled case. They do not rule out a lifecycle regression in other
conditions, nor prove that a 20-second answer delay is safe on physical devices.
## Next discriminating evidence
Use matching first/current versions on both physical devices, with the same
sender direction, STUN provider and page origin/browser profile. Record whether
the actual receiver obtains the full file. Compare local/remote candidate types,
selected pairs and check counters; the current UI now retains these after
failure. A missing public candidate, an absence of candidate pairs, and checks
sent with no responses are distinct observations, not diagnoses by themselves.
Do not change firewall rules or shorten user copy/paste time based only on the
same-machine tests. The original/current comparison has not yet identified a
code change that demonstrably explains the user's physical-device failures.
## Two Brave peers on different networks, subsequent report
The reported setup is the same two devices/networks used for the first-version
trial. In the new logs both peers gather two host candidates and one srflx
candidate, with no relay. Neither reports a connected state or transfer activity.
The sender's sole live snapshot is immediately after applying the answer: one
in-progress pair, one request sent, and zero responses so far. This is not a
snapshot of the whole failed attempt. Both final snapshots have no candidate
pairs; the browser has already discarded the useful evidence.
Each log has its own time origin. Sender “answer applied at 25.8 s” cannot be
compared directly with receiver “failed at 15.1 s” to establish whether the answer
was applied before or after receiver failure. A 701 event with a gathered srflx
candidate also does not identify the reason the peer connection failed.
The v3 UX work changed the signaling envelope version, not candidate gathering or
the SDP applied to the browser. The original default STUN provider was Google;
the current default is PageQuit. Matching that selection is necessary for an
original/current comparison, even with unchanged devices and networks.
Diagnostics now sample candidate-pair counters at 3, 6, 9 and 12 seconds while ICE
is checking, and include allowlisted DTLS transport states. Sampling stops when
checking ends or the session is disposed. Receiver answer creation also takes a
snapshot. These changes improve evidence collection; they are not a demonstrated
fix for the physical-device connection failure.
The isolated comparison was also rerun with `/usr/bin/brave`: original, current,
and current-without-immediate-cleanup all delivered the fixed probe at roughly
20.25 seconds after a deliberate 20-second answer delay. In this local test the
receiver did not report checking until the delayed answer was applied on the
sender, unlike the reported physical-device attempt. It does not reproduce that
attempt or establish that its answer-exchange timing is safe.