darkoperator / Posh-SSH

PowerShell Module for automating tasks on remote systems using SSH
BSD 3-Clause "New" or "Revised" License
978 stars 226 forks source link

Set-SFTPItem Hanging when Quota Exceeded on server #563

Closed comccall closed 1 month ago

comccall commented 7 months ago

When attempting to send a file to an SFTP server using Set-SFTPItem, the command will hang indefinitely if the user has exceeded the storage quota on the server.

In my example, the file will be partially uploaded to the destination and then stop, but instead of returning an error the command hangs until manually stopped. I'm not sure how to capture log output using Posh-SSH for an issue like this.

A similar problem occurs when using the WinSCP .NET assembly, which returns the following in the log:

2024-02-02 00:27:03.298 Status code: 15, Message: 17414, Server: Maximum upload file size quota exceeded for user, Language: en-US 2024-02-02 00:27:03.548 Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 0 2024-02-02 00:27:03.548 Attempt to close connection due to fatal exception: 2024-02-02 00:27:03.548 Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 0 2024-02-02 00:27:03.548 Closing connection. 2024-02-02 00:27:03.548 Fatal error while disposing the SFTP queue. 2024-02-02 00:27:03.548 Connection was lost, asking what to do. 2024-02-02 00:27:03.548 Asking user: 2024-02-02 00:27:03.548 Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 0 () 2024-02-02 00:27:03.548 Script: Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 0 2024-02-02 00:27:08.564 Answer: Retry 2024-02-02 00:27:08.564 Script: Searching for host...

darkoperator commented 7 months ago

Sadly the library does not return that error for me to handle in the module. Seems WinSCP is able to receive the error code and raise it.

comccall commented 7 months ago

Bummer, but thank you for the reply 👍

robinmalik commented 2 months ago

@comccall Given this can't be fixed within Posh-SSH perhaps this can be closed?