Intro/Environment:
Same problem happens to me. It often closes the whole client in "/keepuptodate" mode without visible notification.
- Updated to native portable (with local WinSCP.ini) WinSCP 5.17.6 and *.7 on Win10-1809. Applies also to at least 5.13.9 (tested). Does NOT apply to 5.11.3 (works fine, my previous "stable" in use).
- Using a connection via SFTP-3 to a Linux server (no admin access). As the server closes idle sessions, I use SSH NUll packetes each 60sec. in my profiles.
- I am running WinSCP from command line:
start "" "winscp.exe" "mysession" /keepuptodate // "%LOCALPATH%" "%REMOTEPATH%"
Problem:
The older WinSCP version 5.11.3 worked fine so that after any server-timeout the client stayed open in the background with disconnected state and as soon as a new change in the local directory was recognized, the auto-reconnect kicked in (incl. Win10 Notification-Bar Message). You can see this in the screenshot - notice the red message indicating an auto-reconnect. But this does not work any more since at least the mentioned versions or even since 5.12 (not tested). Instead the client disappears/closes without any notice, which is annoying if you need stable "realtime" sync of the remote location.
Do I miss any (command-line) option with the new version(s)? I have enabled "Debug 2" logging and noticed, that during a common session via standard GUI the client logs the network event lookups each second incl. the SSH keepalive (NULL) packets each 60 sec. Those connections never die. But using the dedicated "/keepuptodate" GUI from command-line with the same saved session-config (60sec. NULL keepalives) there is no logging of any SSH keepalives. So I assume there are no SSH keepalives sent in this mode (Why by the way??). However, this is just a side effect I noticed. The main problem is as described before, that the client closes silently on disconnects without waiting in disconnected state and doing an auto-reconnect on the next local filesystem change.
So... bug or feature? :D
Here are some logs before the client GUI terminates. I won't be able to provide full logs due to to much confidential data in it. But these snippets should tell you where to look for the issue, I hope. :)
## 5.17.7 - lines after last directory listing and before unexpected GUI termination.
. 2020-10-05 11:01:27.009 Startup conversation with host finished.
. 2020-10-05 11:01:27.412 Closing connection.
. 2020-10-05 11:01:27.412 Sending special code: 1
. 2020-10-05 11:01:27.412 Looking for network events
. 2020-10-05 11:01:27.416 Detected network event
. 2020-10-05 11:01:27.416 Enumerating network events for socket 2444
. 2020-10-05 11:01:27.416 Enumerated 1 network events making 1 cumulative events for socket 2444
. 2020-10-05 11:01:27.416 Handling network read event on socket 2444 with error 0
. 2020-10-05 11:01:27.416 Looking for network events
. 2020-10-05 11:01:27.416 Session sent command exit status 0
. 2020-10-05 11:01:27.416 Main session channel closed
. 2020-10-05 11:01:27.417 All channels closed
. 2020-10-05 11:01:27.417 Timeout waiting for network events
. 2020-10-05 11:01:27.417 Selecting events 0 for socket 2444
## GUI terminated!
## 5.13.9 - lines after last directory listing and before unexpected GUI termination.
. 2020-10-06 10:06:28.288 Startup conversation with host finished.
. 2020-10-06 10:06:28.666 Closing connection.
. 2020-10-06 10:06:28.666 Sending special code: 12
. 2020-10-06 10:06:28.666 Sent EOF message
. 2020-10-06 10:06:28.666 Selecting events 0 for socket 2340
## GUI terminated!
## 5.11.3 - working fine! lines after new sync attempt, detecting lost connection and doing reconnect. Then sync kicks in (not in log).
. 2020-10-06 12:09:26.233 Looking for network events
. 2020-10-06 12:09:26.233 Detected network event
. 2020-10-06 12:09:26.233 Enumerating network events for socket 1856
. 2020-10-06 12:09:26.233 Enumerated 33 network events making 33 cumulative events for socket 1856
. 2020-10-06 12:09:26.233 Handling network close event on socket 1856 with error 0
. 2020-10-06 12:09:26.233 Received 28 bytes (0)
. 2020-10-06 12:09:26.233 Selecting events 0 for socket 1856
. 2020-10-06 12:09:26.233 Server unexpectedly closed network connection
. 2020-10-06 12:09:26.233 Connection was lost, asking what to do.
## !!!!!!!!!!! Reconnect kicks in... !!!!!!!!!!!
. 2020-10-06 12:09:26.233 Asking user:
. 2020-10-06 12:09:26.233 Server unexpectedly closed network connection. ()
. 2020-10-06 12:09:26.286 Keep up to date: Server unexpectedly closed network connection.
. 2020-10-06 12:09:26.449 Looking up host "xxx.xxx.xxx.xxx" for SSH connection
. 2020-10-06 12:09:26.449 Connecting to xxx.xxx.xxx.xxx port 22
## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
. 2020-10-06 12:09:26.503 Selecting events 63 for socket 2288
. 2020-10-06 12:09:26.503 We claim version: SSH-2.0-WinSCP_release_5.11.3
. 2020-10-06 12:09:26.503 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:26.503 Looking for incoming data
. 2020-10-06 12:09:26.503 Looking for network events
. 2020-10-06 12:09:26.518 Detected network event
. 2020-10-06 12:09:26.518 Enumerating network events for socket 2288
. 2020-10-06 12:09:26.518 Enumerated 18 network events making 18 cumulative events for socket 2288
. 2020-10-06 12:09:26.518 Handling network write event on socket 2288 with error 0
. 2020-10-06 12:09:26.518 Handling network connect event on socket 2288 with error 0
. 2020-10-06 12:09:26.518 Looking for network events
. 2020-10-06 12:09:26.534 Detected network event
. 2020-10-06 12:09:26.534 Enumerating network events for socket 2288
. 2020-10-06 12:09:26.534 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:26.534 Handling network read event on socket 2288 with error 0
. 2020-10-06 12:09:26.534 Server version: SSH-2.0-OpenSSH_5.3
. 2020-10-06 12:09:26.534 We believe remote version has SSH-2 channel request bug
. 2020-10-06 12:09:26.534 Using SSH protocol version 2
. 2020-10-06 12:09:26.550 Have a known host key of type rsa2
. 2020-10-06 12:09:26.550 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:26.550 Looking for incoming data
. 2020-10-06 12:09:26.550 Looking for network events
. 2020-10-06 12:09:26.589 Detected network event
. 2020-10-06 12:09:26.589 Enumerating network events for socket 2288
. 2020-10-06 12:09:26.589 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:26.589 Handling network read event on socket 2288 with error 0
. 2020-10-06 12:09:26.589 Doing Diffie-Hellman group exchange
. 2020-10-06 12:09:26.589 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:26.589 Looking for incoming data
. 2020-10-06 12:09:26.589 Looking for network events
. 2020-10-06 12:09:26.620 Detected network event
. 2020-10-06 12:09:26.620 Enumerating network events for socket 2288
. 2020-10-06 12:09:26.620 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:26.620 Handling network read event on socket 2288 with error 0
. 2020-10-06 12:09:26.620 Doing Diffie-Hellman key exchange with hash SHA-256
. 2020-10-06 12:09:26.995 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:26.995 Looking for incoming data
. 2020-10-06 12:09:26.995 Looking for network events
. 2020-10-06 12:09:27.117 Detected network event
. 2020-10-06 12:09:27.117 Enumerating network events for socket 2288
. 2020-10-06 12:09:27.117 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:27.117 Handling network read event on socket 2288 with error 0
. 2020-10-06 12:09:27.503 Server also has ssh-dss host key, but we don't know it
. 2020-10-06 12:09:27.503 Host key fingerprint is:
. 2020-10-06 12:09:27.503 ssh-rsa 2048 d9:0b:29:91:64:9b:35:8b:67:8c:1f:56:f5:e1:5b:11
. 2020-10-06 12:09:27.503 Verifying host key rsa2 0x23,...<snip>... with fingerprint ssh-rsa 2048 d9:...<snip>...
. 2020-10-06 12:09:27.503 Host key matches cached key
. 2020-10-06 12:09:27.503 Selecting events 63 for socket 2288
. 2020-10-06 12:09:27.503 Initialised AES-256 SDCTR client->server encryption
. 2020-10-06 12:09:27.503 Initialised HMAC-SHA1 client->server MAC algorithm
. 2020-10-06 12:09:27.503 Initialised AES-256 SDCTR server->client encryption
. 2020-10-06 12:09:27.503 Initialised HMAC-SHA1 server->client MAC algorithm
. 2020-10-06 12:09:27.503 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:27.503 Looking for incoming data
. 2020-10-06 12:09:27.503 Looking for network events
. 2020-10-06 12:09:27.641 Detected network event
. 2020-10-06 12:09:27.641 Enumerating network events for socket 2288
. 2020-10-06 12:09:27.641 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:27.641 Handling network read event on socket 2288 with error 0
! 2020-10-06 12:09:27.641 Using username "pakosch.martin".
. 2020-10-06 12:09:27.641 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:27.641 Looking for incoming data
. 2020-10-06 12:09:27.641 Looking for network events
. 2020-10-06 12:09:27.672 Detected network event
. 2020-10-06 12:09:27.672 Enumerating network events for socket 2288
. 2020-10-06 12:09:27.672 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:27.672 Handling network read event on socket 2288 with error 0
. 2020-10-06 12:09:27.672 Server offered these authentication methods: publickey,gssapi-keyex,gssapi-with-mic,password
. 2020-10-06 12:09:27.672 Using SSPI from SECUR32.DLL
. 2020-10-06 12:09:27.672 Attempting GSSAPI authentication
. 2020-10-06 12:09:27.672 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:27.672 Looking for incoming data
. 2020-10-06 12:09:27.672 Looking for network events
. 2020-10-06 12:09:27.704 Detected network event
. 2020-10-06 12:09:27.704 Enumerating network events for socket 2288
. 2020-10-06 12:09:27.704 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:27.704 Handling network read event on socket 2288 with error 0
. 2020-10-06 12:09:27.704 GSSAPI authentication request refused
. 2020-10-06 12:09:27.704 Server offered these authentication methods: publickey,gssapi-keyex,gssapi-with-mic,password
. 2020-10-06 12:09:27.704 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2020-10-06 12:09:27.704 Using remembered password.
. 2020-10-06 12:09:27.704 Sent password
. 2020-10-06 12:09:27.704 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:27.704 Looking for incoming data
. 2020-10-06 12:09:27.704 Looking for network events
. 2020-10-06 12:09:27.973 Detected network event
. 2020-10-06 12:09:27.973 Enumerating network events for socket 2288
. 2020-10-06 12:09:27.973 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:27.973 Handling network read event on socket 2288 with error 0
. 2020-10-06 12:09:27.973 Access granted
. 2020-10-06 12:09:27.973 Opening session as main channel
. 2020-10-06 12:09:27.973 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:27.973 Looking for incoming data
. 2020-10-06 12:09:27.973 Looking for network events
. 2020-10-06 12:09:28.005 Detected network event
. 2020-10-06 12:09:28.005 Enumerating network events for socket 2288
. 2020-10-06 12:09:28.005 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:28.005 Handling network read event on socket 2288 with error 0
. 2020-10-06 12:09:28.005 Opened main channel
. 2020-10-06 12:09:28.005 Waiting for the server to continue with the initialization
. 2020-10-06 12:09:28.005 Looking for incoming data
. 2020-10-06 12:09:28.005 Looking for network events
. 2020-10-06 12:09:28.105 Detected network event
. 2020-10-06 12:09:28.105 Enumerating network events for socket 2288
. 2020-10-06 12:09:28.105 Enumerated 1 network events making 1 cumulative events for socket 2288
. 2020-10-06 12:09:28.105 Handling network read event on socket 2288 with error 0
. 2020-10-06 12:09:28.105 Started a shell/command
. 2020-10-06 12:09:28.121 Doing startup conversation with host.
## continues with sync operation.