성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] Get Started with Milvus Vector DB i...
[정성태] cyberark/PipeViewer - A tool that...
[정성태] WinForms in a 64-Bit world – our st...
[정성태] 예제에서 SELECT_SQL도 내부적으로는 SqlCommand/...
[victor] SELECT_LINQ SELECT_SQL 같은 쿼리인...
[victor] 답변 갑사합니다. 예외(Exception)가 났습니다. ...
[정성태] 일단, 위의 방식대로 하면 예외(Exception) 없이 잘 동...
[정성태] Windows 10 (버전 1809)에 이런 기능이 ^^ 추가되...
[정성태] pde windbg extension ; https://lea...
[정성태] // GetEnumerator extensions for Ran...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <h1 style='font-family: Malgun Gothic, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>ssh로 명령어 수행 시 멈춤 현상</h1> <p> 아래의 명령어를 수행하면,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > c:\temp> <span style='color: blue; font-weight: bold'>ssh testusr@192.168.100.50 "...[명령어]..."</span> </pre> <br /> 몇 번에 한 번은 명령어가 종료되지 않고 멈춰 있는 현상이 있습니다. 그 상태에서 엔터를 누르면 이런 메시지가 나오는데요,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > channel_by_id: 0: bad id: channel free client_input_channel_req: channel 0: unknown channel channel_by_id: 0: bad id: channel free channel </pre> <br /> 이때의 소켓 상태를 보면,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > c:\temp> <span style='color: blue; font-weight: bold'>netstat -ano | findstr 192.168.100.50:</span> TCP 192.168.100.20:19695 192.168.100.50:22 CLOSE_WAIT 5616 </pre> <br /> 서버에서 연결을 끊은 것으로 나옵니다. 의미인즉, ssh로 전달한 명령은 모두 수행한 다음 서버 측에서 socket.close를 했다는 것을 의미합니다. 실제로 테스트를 해보면, 저 상태가 나왔을 때 명령어들이 모두 수행되었다는 것을 확인할 수 있습니다.<br /> <br /> 그런데, 도대체 왜 클라이언트 측에서 ssh 연결을 못 끊는 것일까요? 딱히 검색을 해봐도 ^^; 답이 없군요. 아쉬운 대로 일단 timeout 등의 외부 명령어와 연동하는 것으로 우회할 수는 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > How to set ssh timeout? ; <a target='tab' href='https://stackoverflow.com/questions/4936807/how-to-set-ssh-timeout'>https://stackoverflow.com/questions/4936807/how-to-set-ssh-timeout</a> </pre> <br /> 재미있는 건, 원인 파악을 위해 '-v' 옵션을 주면 해당 현상이 재현되지 않는다는 점입니다. 그러니까, -v 옵션으로도 해결(?)이 된 것입니다. (참고로, 앞으로 더 많이 수행하면 해당 현상이 재현될 수도 있을 텐데, 아직은 한 번도 없었습니다.)<br /> </p><br /> <br /><hr /><span style='color: Maroon'>[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
8677
(왼쪽의 숫자를 입력해야 합니다.)