Repository navigation
test: wait for the flood to pass its cap before reading the device link - #1817
Merged
Merged
Conversation
The device terminal test sent forty flood frames to the fake session and started reading the link without waiting for the pane's reader thread to hand them over. A read begun before the 1 MiB cap was passed made room for the rest of the flood, so the quiet pane's echo landed behind 4 to 15 flood lines depending on when its own reader thread ran. The test now waits for the flooding pane to be dropping before it sends keys and reads, and expects no flood line ahead of the echo.
yansfil
added a commit
that referenced
this pull request
Oct 29, 2026
…lines (#1828) Closes with-hide/hide-private#164 Closes with-hide/hide-private#143 ## Summary Linux CI에서 `a_pane_past_its_unsent_keys_reads_ended_while_other_panes_keys_go_on`가 5 s 대기 끝에 실패하던 원인을 고칩니다. 테스트의 기다림이 잠금을 쥔 채 링크가 받은 줄 전부(16 KiB 키 줄 17개)를 매번 다시 파싱했고, writer는 줄마다 같은 잠금이 필요해 그 잠금을 얻지 못하고 굶었습니다. 이제 기다림은 링크가 줄을 받을 때까지 잠들고, 새 줄만 잠금 안에서 복사해 밖에서 한 번씩 파싱하며, 조건은 마지막 줄만 봅니다. 같은 파일의 link 대기 9곳을 이 기다림으로 바꿨습니다. 제품 코드와 대기 시간(WAIT)은 바뀌지 않습니다. #1817(읽기를 cap overflow 전에 시작한 순서 문제)과는 다른 원인입니다. ## Review - **판단해 주세요**: 링크 대기의 조건을 "마지막 줄이 기다리는 key 줄"로 바꿨습니다. 각 테스트에서 그 줄이 큐의 마지막이라 그 뒤 줄이 오면 실패합니다. - **조심해서 볼 파일**: `hide-node/src/terminal/device_tests.rs` - `GatedLink::wait_for_lines`가 `written` 잠금과 새 `wrote` Condvar를 씁니다. - **조심해서 볼 파일**: 같은 파일 64-pane 테스트 - 예전 대기는 p63에서 멈추고 그 뒤에 큐된 p0 Enter를 다시 읽기로 셌습니다. 이제 마지막에 큐된 p1 Enter를 기다립니다. ## Evidence - **확인한 것**: 원인. 고치기 전 이 Mac에서 24개 병렬로 잰 결과, release 뒤 writer가 `written` 잠금을 기다린 시간이 대기 전체와 거의 같았습니다(예: 대기 53 ms 중 테스트가 쥔 시간 44 ms, writer가 기다린 시간 43 ms). - **확인한 것**: 고친 뒤 같은 측정에서 writer의 잠금 대기는 실행당 약 1 µs(최대 0.99 ms)입니다. - **확인한 것**: 대상 테스트를 최종 빌드로 48개 병렬 x 40회(CPU burner 14개, load 최대 167): 1920회 중 0회 실패. - **확인한 것**: device 모듈 24개 테스트 전체를 load 70-95에서 480회 반복: 0회 실패. - **확인한 것**: 64-pane 테스트는 load 130-167에서 고치기 전 176회 중 151회, 고친 뒤 600회 중 23회 실패했습니다. 남은 실패는 debug 빌드로 16 MiB 키를 인코딩하는 writer의 실제 일이 그 load에서 5 s 가드에 닿은 것입니다. - **확인한 것**: `verify-cargo.sh fmt-check`, `clippy -p hide-node --all-targets -D warnings`, `nextest -p hide-node`(224 통과). - **확인하지 못한 것**: 대상 테스트는 이 Mac에서 고치기 전에도 2520회(load 최대 38) 중 0회 실패해, 실패 자체는 로컬에서 재현하지 못했습니다(실패는 Linux 전용). 증거는 위 잠금 대기 측정과 코드이고, Linux 확인은 PR CI에 맡깁니다. - **확인하지 못한 것**: Windows, Linux 로컬 반복(이 기계에 없음). <details><summary>Verification record</summary> - base 4a856f5, head b9d8c86 - 재현 명령: `target/debug/deps/hide_node-* --exact terminal::device::tests::a_pane_past_its_unsent_keys_reads_ended_while_other_panes_keys_go_on` 병렬 반복 </details>
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#284
Summary
main push verify(run 40795002451, 047d094)를 빨갛게 만든
a_flooding_pane_holds_back_neither_another_panes_keys_nor_its_frames는 #1813 때문이 아니라 10-12부터 Linux·Windows에서 반복된 flaky입니다.테스트가 flood frame 40개를 가짜 세션에 넣기만 하고, 그 pane의 reader 스레드가 그것을 링크 큐에 넘겨 1 MiB cap을 넘기기 전에 읽기를 시작할 수 있었습니다.
그러면 읽는 만큼 자리가 나 flood가 계속 올라가고, quiet pane의 echo가 그 사이 몇 번째에 끼는지는 스케줄러가 정했습니다(4-15줄).
이제 테스트는 flood가 cap을 넘겨 버려진 상태를 기다린 뒤 key·echo·읽기를 하고, echo 앞에 flood 줄이 하나도 없음을 확인합니다. 제품 코드는 바뀌지 않습니다.
Review
<= 3에서== 0으로 좁혔습니다. cap을 넘긴 flood는 버려지므로 0이 바깥에서 정해지는 답이라고 봤습니다.hide-node/src/terminal/device_tests.rs- 기다림이 링크 큐의 내부 상태(dropping)를 봅니다. 이 모듈의 다른 테스트도lock(&uplink.state)를 읽고, 기다림은 모듈의wait_for(WAIT hang guard)입니다.Evidence
git diff --stat빈 결과).verify-cargo.sh fmt-check,nextest -p hide-node(224 pass),clippy -p hide-node --all-targets -D warnings통과.Verification record
target/debug/deps/hide_node-* --exact terminal::device::tests::a_flooding_pane_holds_back_neither_another_panes_keys_nor_its_frames반복