File-Tunnel icon indicating copy to clipboard operation
File-Tunnel copied to clipboard

CPU usage 100% on MacOS

Open kim0 opened this issue 1 year ago • 3 comments

ft is working very well for me. I'm using it daily. However, I recently noticed the macbook was a little warm, when I checked the ft process had one CPU core at 100%. Check the attached screenshot. I'm guessing this might be due to checking if the file was written very rapidly! Maybe there is a way to hook into file monitoring/watch services into macos instead ? or at least check less aggressively. Happy to test any debug builds. Screenshot 2024-08-19 at 6 39 57 PM

kim0 avatar Aug 19 '24 15:08 kim0

Thanks Ahmed! Yes it should definitely not use that much CPU. I'll look into it.

What protocol are you tunneling? Does the high CPU usage happen straight away, after a while, after a disconnect?

fiddyschmitt avatar Aug 20 '24 00:08 fiddyschmitt

You were right - it was checking if the file was written, without sleeping!

        public static void Wait(int ms)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Thread.Sleep(ms);
                return;
            }

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                WindowsDelay.Wait(ms);
                return;
            }
        }

I'll fix it up tonight :)

fiddyschmitt avatar Aug 20 '24 05:08 fiddyschmitt

This is now fixed in v2.2.1

Thanks Ahmed!

fiddyschmitt avatar Aug 20 '24 07:08 fiddyschmitt