Repository navigation
fix: run one Mobile pass per settings change and read tailscale commands at their exit - #2185
Merged
Merged
Conversation
…own frames in the hided mobile tests A mobile_method followed at once by mobile_enable spawned two passes, and the second read Tailscale after a test had changed the fake under the first, so the funnel test counted two serve adds (with-hide/hide-private#480). A settings change now owes one pass and a pass settles every change it read. The unadmitted-phone test waited for a no-phones frame that a frame published before the pairing also matched, so the start ran before the revoke and answered timeout (#435). The phone is listed first, then revoked. The app-executable test no longer reads through the 15 s command deadline of a loaded machine (#524); #158 shared the stale-frame wait.
On macOS the standard library makes a pipe and marks it close-on-exec in two calls. A child another thread starts between them keeps the write end for as long as it lives, so hided's `wait_with_output` waited for a pipe that stayed open and ran a `tailscale` command that had exited in milliseconds to its 15 s deadline. Measured on macOS with other threads starting long-lived children: a command exited after 9 ms and its output did not close in 3 s. Every tailscale command now runs as an owned child read by `OwnedChild::capture_until` on a blocking task, which answers when the command has exited and its tree has ended, under the same 15 s deadline and a 1 MiB output bound. This removes the test-only `status_within` deadline. Two tests hold the change: a command that leaves a process holding its output answers at its exit, and two settings changes that meet a running pass cost one pass more. Both fail with the fix reverted.
…its the output bound The full `tailscale status --json` lists every peer at about 1.2 KB each: 34 KB on a tailnet of 27, 3 KB without the peers. The 1 MiB bound that came with reading a command at its exit is reached at some 900 peers, which would have failed every status read and left Mobile blocked where the unbounded read worked. hided reads none of the peers' fields, so it asks with `--peers=false`: the answer no longer follows the size of the tailnet, and the bound stays for a child that writes without end. A test with a tailnet whose full answer is past the bound holds the flag, and the pass-count test waits for a second forced pass so the tasks queued ahead of it have run before it counts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes with-hide/hide-private#435
Closes with-hide/hide-private#480
Closes with-hide/hide-private#524
Related: with-hide/hide-private#158 (이 PR로 닫지 않습니다. 아래 Summary)
Summary
휴대폰 연결(hided mobile) 시험이 가끔 실패하던 원인은 제품 쪽 둘과 시험 쪽 하나였습니다.
tailscale명령이 15초 기한까지 갔습니다. 운영에서도 pane 시작과 겹치면 상태 읽기가 실패하고, 두 번 연속이면 노출이 내려갑니다. 이제 명령이 끝난 시점에 답을 읽습니다 (플랫폼 계층에 이미 있는OwnedChild::capture_until, 같은 15초 기한, 출력 1 MiB 상한). 상한을 넘는status --json이 없도록status는 피어를 뺀 읽기(--peers=false)로 묻습니다. 전체 답은 피어당 약 1.2 KB라 약 900대 tailnet에서 상한을 넘어 Mobile이 막히는데, hided는 피어 필드를 읽지 않습니다. 앞선 시험 전용 600초 기한(status_within)은 없앴습니다.tailscale명령의 15초 기한에 묶인 것과 맞아 #524와 같은 원인일 가능성이 크지만, 그 실행에서 명령이 15초에 걸렸는지 기록이 없어 원인은 확정하지 못했습니다.Review
hided/src/mobile/tailscale.rs-status가--peers=false로 묻고, 명령 실행이wait_with_output(pipe 끝까지 대기)에서 blocking 작업 위의capture_until로 바뀌었습니다. future가 먼저 버려져도 blocking 작업이 15초 기한 안에 자식 트리를 끝냅니다 (이전의kill_on_drop자리).hided/src/mobile/mod.rs- 패스 합치기(PassOwed):take가 설정을 읽는 같은Inner잠금 안이라 놓치는 변경이 없고, 시계와 Settings 열기는 강제 패스라 그대로입니다.hided/tests/it/mobile.rs,support/fake_tailscale.rs-paired_phone이 폰이 목록에 오른 프레임까지 읽고, 대역에status를 붙잡는 문(hold-status)과 출력을 쥔 프로세스를 남기는 문(hold-pipes)이 생겼습니다.docs/PERFORMANCE_TESTING.md표 갱신).Evidence
switched false뒤에serve.failed add, 그 뒤serve.removed가 오고serve.funnel_on은 한 번뿐이라 패스 둘이 켜진 상태로 돈 것; #435는start.answered revoked-1 timeout과 그 폰의terminal.input_discarded가phone.revoked로그보다 앞선 것. 20회 반복(아래)은 고치기 전 기준 비율이 없어 이 분석을 보강할 뿐 단독 증거가 아닙니다.sleep 20을 900개 띄우는 동안tailscale status대역을 동시에 4~8개씩 반복 호출했습니다. 첫 실험 4349회 중 3초 timeout 1회; 자식의 종료와 pipe 끝을 따로 잰 실험에서exit_after=9ms인데 3초 안에 끝이 오지 않은 경우가 잡혔고(시작이 느린 경우는 0), 제품 호출도 같은 실행에서 1회 timeout. 한 번의 우연이 아니라 두 실행에서 같은 모양입니다.exit_after=15ms인데 끝이 안 오는 경우가 잡혔는데도 제품 호출은 0건이었습니다.capture_until이 받는 최대가 1 MiB입니다. 이 Mac(Tailscale 1.96.5, 피어 27개)에서status --json은 34,332바이트(피어당 약 1.16 KB),--peers=false는 2,967바이트(피어 0, 사용자 0),serve status --json은 295바이트입니다. hided가 읽는BackendState,Self,CurrentTailnet,CertDomains는 피어 없는 답에도 그대로 있고, 이 크기는 tailnet 크기와 무관합니다. 피어를 넣은 전체 답은 약 900대에서 1 MiB를 넘습니다. 시험a_tailnet_too_big_to_list_its_peers_still_answers_status는 전체 답이 1 MiB를 넘는 tailnet(1,500대)에서 플래그를 빼면child output exceeds 1048576 bytes로 실패합니다.a_process_left_holding_the_command_s_output_does_not_hold_its_answer는 이슈 본문과 같은timed out after 15s로,two_changes_that_meet_a_running_pass_cost_one_pass_more는 패스 합치기를 되돌리면tailscale status가 7번 돌아(고친 코드는 6번 모두 4번) 상한 4를 넘어 실패합니다. 출력 밖에 있는 보유자는hide-platform의 기존 세 시스템 계약 시험a_pipe_holder_outside_the_tree_does_not_hold_the_answer가 맡습니다.hided단위 617개와 통합 136개 통과(36개는 원래 ignore), clippy-D warnings와 fmt 깨끗. 이 Mac mini에서verify-cargo.sh test가 workspace 전체를 돌 때hide-agent-hooks의 메모리 시험 둘(훅 기한 1250ms 초과)이 부하 속에서 실패했고 이 PR이 건드리지 않은 크레이트입니다.d4f23c551) 위에 네 시험(Remove scripts, tests and documentation that CI no longer needs #435 Assert the alternate-screen wheel contract on the bytes the PTY receives #480 Wait out an agent_pane_busy refusal, which Herdr prints on stderr #524 #158의 것)을 각각 20번 등록한 프로브 커밋(6b1960ad7, 다음 커밋에서 되돌림)을 PR의 rust 레인(ubuntu, nextestci프로필, 재시도 1회)에서 돌려 전체 4808개가 통과했고 프로브 80개가 모두 첫 시도에 통과했습니다 (재시도와FLAKY줄 없음, run 42377510005). 고치기 전 비율을 재지 않아 고침 전후를 가르는 증거는 아니고, 이 코드에서 20회 연속 통과했다는 확인입니다.tailscale명령이 실제로 15초에 걸렸는지는 기록이 없어 확인하지 못했습니다. 이 PR의 macOS 전용 시험 레인은 PR CI에 없고 야간 레인에 있습니다.--peers=false는 이 Mac의 1.96.5 도움말에서 확인했고 더 오래된 Tailscale CLI에서의 지원은 확인하지 못했습니다.