设置:
当我们在 CentOS Hyper-V VM 上使用 SCP 将文件复制到目标 (SunOS) 时,它会达到 100%,然后挂起,而不是关闭连接。当我们最终使用 ctrl+C
退出,远端文件为空。
整个过程在非常小的文件上运行良好,但如果是几十行,它就会开始挂起。
CentOS 机器使用默认开关。SSH
在 CentOS 虚拟机上运行良好。
来源 : 在 Hyper-V (Windows 10 Ent.) 上运行的 CentOS 7.6 VM
目的地 : SunOS 5.6 x64 机器
日志:
scp -vvv tst.txt user@target.domain:/tmp/
...
debug1: Sending command: scp -v -t /tmp/
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 4
debug1: Remote: Missing locale support for LANG=en_US.UTF-8
debug2: channel 0: rcvd adjust 201600
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
Sending file modes: C0664 12840 test.txt
test.txt 100% 13KB 0.1KB/s 02:52
追踪 :
相关部分是以下 block ,当文件具有任何显着大小时,它会无限循环:
write(1, "\rtest.txt "..., 185) = 185
rt_sigaction(SIGALRM, NULL, {0x555900a4ebf0, [], SA_RESTORER|SA_INTERRUPT, 0x7fc354919280}, 8) = 0
alarm(1) = 0
rt_sigreturn({mask=[]}) = -1 EINTR (Interrupted system call)
read(7, 0x7ffe718fdb0f, 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---```
最佳答案
在我的情况下,通过 OpenVPN 连接时 MTU 存在问题。我在 OpenVPN 配置文件中添加:
mssfix 1200
现在一切正常。转移不再以 100% 挂起。
关于centos - scp 上传后挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54894837/