Repository navigation
Conversation
A device whose SSH server takes the TCP connection but never sends its greeting held the core's stop, and a removal on the core's thread, for the 15 s dial bound: the device's session coordinator was joined while it waited in that dial. The device transport now has a close that ends what it started. The core closes it before joining the coordinator, for a removed or retried device and when the core stops. An SSH client's close ends a dial or handshake still waiting with a refusal and refuses every later dial; a WSL distribution and an arrived node close their link. Closes with-hide/hide-private#75
yansfil
marked this pull request as draft
October 29, 2026 09:23
Contributor
Author
|
#1830이 main에 들어가서(ce9f790) 이 PR은 merge하지 않고, main 위에서 남은 범위를 다시 확인해 새 브랜치(fix/ssh-shutdown-system-ssh)로 진행합니다. 새 PR이 열리면 이 PR은 닫습니다. |
Contributor
Author
|
main 위에서 다시 확인한 결과 #1830이 이 문제를 이미 고쳤고, 그걸 지키는 회귀 테스트는 #1841로 옮겼습니다. |
yansfil
added a commit
that referenced
this pull request
Oct 29, 2026
…silent device (#1841) Closes with-hide/hide-private#75 Related: #1830 (the fix, merged as ce9f790), #1832 (earlier attempt, superseded) ## Summary SSH 상대가 연결만 받고 SSH 인사를 보내지 않을 때 hided 종료와 기기 제거가 붙잡히던 문제(#75)는 #1830이 이미 고쳤습니다. main에서 실제 연결 경로로 재현해 보니 종료는 0.16초, 제거는 3ms에 끝나고 상대 소켓도 바로 닫혔습니다. 이 PR은 코드를 바꾸지 않고, 그 동작이 다시 깨지지 않게 회귀 테스트 두 개를 더합니다. 두 테스트는 Windows의 ssh.exe에서도 돌도록 windows check lane에 넣었습니다. 화면 변경 없음. ## Review - **조심해서 볼 파일**: `herdr-core/src/handle.rs` - 진짜 `Core::create`와 시스템 `ssh`, 인사 없는 loopback listener로 종료와 제거를 봅니다. - **조심해서 볼 파일**: `.github/workflows/pr.yml` - windows check에 두 테스트를 고르는 step 하나를 더했습니다. - **판단해 주세요**: 시간은 30초 hang guard로만 씁니다. alias에 `ConnectTimeout 600`을 줘서 ssh가 스스로 끝날 수 없게 했습니다. sign-in 한도는 90초라, 30초 안에 상대 소켓이 닫히면 core가 끝낸 것입니다. ## Evidence - **확인한 것**: main(ce9f790) 재현 - 종료 156ms, 제거 2.7ms, 둘 다 `ssh`가 kill되어(`host.child_ended killed:true`) 상대 소켓이 닫힘. - **확인한 것**: 남는다고 봤던 세 가지는 main에서 이미 해결됨(아래 접힌 블록). - **확인한 것**: 심은 결함 1 - core 종료의 attempt cancel을 빼면 종료 테스트가 소켓이 열려 있다고 실패(35.6초). - **확인한 것**: 심은 결함 2 - 기기 교체/제거의 attempt cancel을 빼면 제거 테스트가 같은 이유로 실패(30.4초). - **확인한 것**: listener의 accept 스레드는 fixture가 소유하고 drop에서 깨워 join합니다. core가 dial하지 않게 심으면 30.5초에 "never dialed"로 끝나고 남는 스레드가 없습니다. - **확인한 것**: fixture alias는 `IdentityFile none`, `IdentitiesOnly yes`, 그리고 private `UserKnownHostsFile`/`GlobalKnownHostsFile`을 씁니다. `ssh -G`로 기본 `~/.ssh/id_*`가 빠지는 것을 확인했습니다. - **확인한 것**: 두 수정 뒤 심은 결함 두 개를 다시 돌려 각각 35.4초, 30.4초에 실패했습니다. - **확인한 것**: macOS에서 `herdr-core` nextest ci profile 전체 3477개, clippy `-D warnings`, `cargo fmt --check` 통과. - **확인하지 못한 것**: Windows와 Linux 실행은 CI가 합니다. 로컬은 macOS뿐입니다. - **확인하지 못한 것**: 설치된 앱으로 native 확인은 하지 않았습니다. 화면 변화가 없는 종료 경로입니다. <details><summary>남는다고 봤던 범위의 판단</summary> - (a) 제거 때 kit Remove 뒤 link 닫기: `queue_device_kit_removal`이 Ready link를 phase에서 꺼내 kit worker에 넘기고, worker가 Remove 뒤에 닫습니다. `removing_a_connected_device_takes_its_kit_off_and_then_closes_the_helper`, `an_install_answer_that_arrives_after_removal_brings_nothing_back`이 지킵니다. - (b) establish 중 close: 제거, 교체, 동의 철회는 `advance_host_generation`으로 attempt를 cancel하고 세대를 올립니다. disarm 전 cancel은 ssh를 죽이고, disarm 뒤 cancel은 establish가 다시 보고 닫거나, 늦은 결과를 `ingest_host_established`가 옛 세대로 보고 닫습니다. - (c) 종료 중 establish: `take_device_attempts`가 cancel하고 최대 5초 기다립니다. disarm 직후에 끝난 attempt가 그 사이 Ready로 들어가도 link의 마지막 참조가 runtime과 함께 drop되면 reader가 닫고 ssh를 회수합니다. - 원래 원인(session sync coordinator가 dial에 막혀 join이 15초 걸림)은 #1830 뒤 사라졌습니다: link가 없으면 `LinkedHerdr::connect`가 바로 거절합니다(재현 로그 `connect.failed ... The device's helper is not connected`). </details> <details><summary>Verification record</summary> - base: ce9f790, head: d4fcb43 - `bash scripts/verify-cargo.sh nextest --profile ci -p herdr-core`: 3477 passed, 13 skipped (nextest 0.9.143, macOS) - `bash scripts/verify-cargo.sh clippy -p herdr-core --all-targets -- -D warnings`: 0 warnings - `bash scripts/verify-cargo.sh fmt-check`: pass - `python3 -m pytest scripts/tests/test_ci_plan.py`: 79 passed; `test_called_workflow_permissions.py`: OK </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.
Draft: #1830(기기를 system ssh로 연결)이 이 원인을 없애므로 그 merge 뒤 남는 범위(제거 때 kit Remove 뒤 link 닫기, establish 중 close gate, 종료 시 진행 중 establish 끝내기)로 다시 만듭니다.
Closes with-hide/hide-private#75
Summary
SSH 기기가 TCP 연결은 받고 SSH 인사를 보내지 않으면, hided 종료가 그 기기 연결 대기에 붙잡혀 있었습니다(재현: 30초).
같은 이유로 그런 기기를 지우면 core의 이벤트 thread도 30초 멈췄습니다.
이제 core가 기기를 놓을 때(종료, 기기 제거, 재연결) 먼저 기기 전송을 닫고, 그 닫기가 기다리던 연결 시도를 바로 끝냅니다.
대기 한도(15초)는 그대로이고, 줄이지 않았습니다.
화면 변경 없음.
Review
herdr-core/src/runtime/devices.rs-RetiredRemote가 닫기 뒤에 coordinator를 join합니다. runtime mutex 밖에서 drop되는지(take_retired_remote_syncs,take_remote_syncs호출부) 봐 주세요.hide-node/src/ssh.rs-connect가 닫기 신호와 dial을select!로 경쟁시킵니다. 닫힌 client는 다시 dial하지 않습니다. 같은 client를 쓰는 터미널과 연결 테스트도 닫기 뒤엔 거절됩니다.hide-node/src/ssh/device.rs- 아직 만들어지지 않은 client가 닫기와 경합해도 dial하지 않게, 만든 직후 닫힘을 다시 봅니다.close는 link를 닫습니다. 기존에도 core 종료와 기기 놓기에서 link가 닫혔으므로 동작 변화는 없다고 봤습니다.Evidence
herdr-corehandle::tests두 개 - 실제 SSH 연결기와 인사 없는 listener로, listener가 연결을 받은 뒤 core를 drop/기기를 제거합니다. 수정 후 0.3초 통과, 닫기 한 줄을 빼면 각각 30.0초로 실패(10초 상한).hide-nodeclose_ends_a_dial_waiting_for_the_greeting_and_refuses_the_next- 닫기 뒤 dial 결과가 timeout이 아니라 "connection was closed" 거절이고, 소켓이 닫히고, 다음 dial은 연결 전에 거절됩니다.hide-node-link,hide-node,herdr-core전체 3725개 통과(nextest ci profile); 위 crate와hided에 clippy-D warnings,cargo fmt --check통과.hided테스트 바이너리는 이 Mac의 디스크 부족(링크 중 errno 28)으로 로컬에서 돌리지 못했습니다.hided소스는 바뀌지 않았고 CI가 돌립니다.Verification record