FileTransferProgress called N/sec once e.FileProgress hits 100% on a still growing remote file

Advertisement

dmitry_20220518
Joined:
Posts:
8

FileTransferProgress called N/sec once e.FileProgress hits 100% on a still growing remote file

Environment:
VS2022 on Windows 10, C#, .NET 4.8, Console App, NuGet downloaded WinSCP assembly on 2022-May-17
  1. On Linux: gzip -c HUGEFILE.txt > growing.gz
  2. On Windows: run Repro.cs
  3. While e.FileProgress is < 100%, callback prints out every second
  4. Once e.FileProgress hits 100%, but with the remote file is still growing, callback is called back constantly
Sample output from below program – look at the milliseconds after it hits 100%
[06:07:41.067] (0%) | [0]
[06:07:41.067] (0%) | [0]
[06:07:41.067] (0%) | [0]
[06:07:42.003] (9%) | [2,424,552]
[06:07:43.012] (26%) | [2,998,804]
[06:07:44.013] (42%) | [3,097,060]
[06:07:45.029] (51%) | [2,797,049]
[06:07:46.006] (68%) | [2,929,040]
[06:07:47.009] (85%) | [3,033,952]
[06:07:47.965] (100%) | [3,059,305]
[06:07:47.965] (100%) | [3,059,305]
[06:07:47.965] (100%) | [3,064,146]
[06:07:47.965] (100%) | [3,064,146]
private class Repro
{
    public void Run()
    {
        SessionOptions sessionOptions = new SessionOptions
        {
            Protocol = Protocol.Sftp,
            HostName = "192.168.1.42",
            UserName = "username",
            Password = "password",
            SshHostKeyFingerprint = "ssh-ed25519 255 fingerprint",
        };
 
        using (Session session = new Session())
        {
            session.FileTransferProgress += Session_FileTransferProgress;
 
            TransferOptions transferOptions = new TransferOptions
            {
                TransferMode = TransferMode.Binary,
                ResumeSupport =
                {
                    State = TransferResumeSupportState.On
                }
            };
 
            session.Open(sessionOptions);
            session.GetFiles($"/tmp/growing.gz", "growing.gz", false, transferOptions).Check();
        }
    }
 
    private void Session_FileTransferProgress(object sender, FileTransferProgressEventArgs e)
    {
        Console.WriteLine($"[{DateTime.Now:hh:mm:ss.fff}] ({e.FileProgress:P0}) | [{e.CPS:N0}]");
    }
}
 
static void Main(string[] args)
{
    Repro r = new Repro();
    r.Run();
}

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: FileTransferProgress called N/sec once e.FileProgress hits 100% on a still growing remote file

Thanks for your report. I'll look into it.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: FileTransferProgress called N/sec once e.FileProgress hits 100% on a still growing remote file

I have added this issue to the tracker:
Issue 2078 – When transferring a growing file, after its original size is reached, the Session.FileTransferProgress event starts being triggered continuously

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

Reply with quote

Advertisement

You can post new topics in this forum