ChangemakerStudios / Papercut-SMTP

Papercut SMTP -- The Simple Desktop Email Server
2.92k stars 269 forks source link

High Systemload by Papercut #255

Open Hackwar opened 1 year ago

Hackwar commented 1 year ago

Describe the bug I had Papercut running in the background continously and while I had hardly any mails in the inbox, it regularly created spikes in the CPU usage, but more importantly it continously read ~20MB/s of data from my SSD. That resulted in my SSD getting very hot and after a few hours of running the notebook without Papercut in the background, the temperature is indeed a lot lower. (Yes, the thermal construction of my notebook is bad.) In any way, I would expect there to be next to no activity from Papercut when idling. Side note: I'm rarely restarting my computer, but put it in hibernation each time. Maybe that has something to do with that?

To Reproduce I have no idea.

Expected behavior Next to no CPU and especially SSD load when idling.

Screenshots Didn't create them at the time.

Desktop (please complete the following information):

Additional context

jzabroski commented 1 year ago

To Reproduce I have no idea.

If you spend enough time to care about this, could you spend the time to also compile it and run it locally with a profiling tool like Redgate ANTS Profiler? Note, I am not a contributor on this project, I am always just stunned when professional software developers complain about performance but offer absolutely nothing substantive in their performance complaints, but want other software developers to investigate heresy performance issues. The thermal construction of your notebook is irrelevant here. Bring data.

it regularly created spikes in the CPU usage

What did you do to measure this? What was the duration of the spike?

it continously read ~20MB/s of data from my SSD

How did you determine the reads came from Papercut and not from, say, your antivirus/antimalware service?

You may want to pick up a copy of The Every Computer Performance Book to get started learning about computer performance so that you can contribute more useful information. Windows Task Manager is not a great source of information to report performance problems unless it's a very stark problem like "CPU stays pegged at 100% for 2 minutes".

jonsa commented 1 year ago

If you spend enough time to care about this, could you spend the time to also compile it and run it locally with a profiling tool like Redgate ANTS Profiler?

I am always just stunned how some people think, just because it's second nature to them, that every one else should be able to do it. I mean it's obvious that every professional software developer should know every language and toolchain to compile, run and debug code they have no familiarity with [/sarcasm].

To add some actual feedback to original topic, albeit being two screenshots from Windows Task Manager. I too have similar issues with Papercut using more and more system resources as time passes without reboot. Currently it's using about half my idle CPU.

image

After a restart it utilizes practically nothing.

image

Personally it doesn't really bother me since I just restart the software regularly.

jzabroski commented 1 year ago

Initial thought was, looking at your screenshot, to search Google for "webview2 memory leak". Found this: https://github.com/MicrosoftEdge/WebView2Feedback/issues/1633#issuecomment-1285697164

It's very possible that webview2 isn't the culprit, BTW. But that would be where to look first. https://www.nuget.org/packages/Microsoft.Web.WebView2/1.0.1462.37 is ten months old.

See, even your sharing that screenshot was way more helpful than "I have no idea". By the way, I did explain a helpful resource to learning about performance troubleshooting - and it definitely isn't second nature to me. But this is a free project. It seems obvious to me users should have etiquette to be helpful as possible in reporting bugs and steer clear of anecdotes. I'm sorry you disagree. 🤷

Hackwar commented 1 year ago

To Reproduce I have no idea.

If you spend enough time to care about this, could you spend the time to also compile it and run it locally with a profiling tool like Redgate ANTS Profiler?

I don't have the toolchain to do that and no, I don't care enough to invest days into learning all the ins and outs of this project. Similarly how you don't give a f--k about my FOSS project.

it regularly created spikes in the CPU usage

What did you do to measure this? What was the duration of the spike?

it continously read ~20MB/s of data from my SSD

How did you determine the reads came from Papercut and not from, say, your antivirus/antimalware service?

So, I've been having issues with my notebook for the last 2 years. The fan is constantly spinning on high rpm, the whole system gets very hot. I replaced the fan 2 times and got the whole mainboard, heatpipes and fan replaced under warranty recently. I keep my notebook in a very well ventilated position and regularly clean the cooler. I checked my whole software stack, from UEFI BIOS over Windows, drivers and all my other tools, like IDE and Windows Defender. None of this made a real difference. Then I killed the Papercut process and all of a sudden my problems were solved. I invested way to much time into this already. I had the courtesy of reporting this issue and that's it. I learned from this, that I'm not going to leave Papercut running in the background and I couldn't care less how qualified you think my report is.

jzabroski commented 1 year ago

So, I've been having issues with my notebook for the last 2 years.

...you did not even mention what version of Papercut you have installed. What good does it do if you are on a version of Papercut that is 2 or more years old and are reporting a bug with it without upgrading? This is etiquette for an open source project. Connect the dots and read the link I posted - there was a bug in WebView2 that is likely causing your problem, not papercut. If you really think you are being helpful, you are not - because others will see your post and think Papercut has quality assurance problems. So posting stuff without any data, screenshots, or any way to reproduce is just gossip. Hope you can begin to see that it's not very constructive. We (open source contributors) donate our free time. I cant even tell you how many hours I have wasted of my life because someone said my FREE software had performance issues/memory leaks. So, yes, be WAY more considerate.

Payn commented 6 months ago

Initial thought was, looking at your screenshot, to search Google for "webview2 memory leak". Found this: MicrosoftEdge/WebView2Feedback#1633 (comment)

It's very possible that webview2 isn't the culprit, BTW. But that would be where to look first. https://www.nuget.org/packages/Microsoft.Web.WebView2/1.0.1462.37 is ten months old.

See, even your sharing that screenshot was way more helpful than "I have no idea". By the way, I did explain a helpful resource to learning about performance troubleshooting - and it definitely isn't second nature to me. But this is a free project. It seems obvious to me users should have etiquette to be helpful as possible in reporting bugs and steer clear of anecdotes. I'm sorry you disagree. 🤷

Seems like a memory leak indeed. Related: https://github.com/ChangemakerStudios/Papercut-SMTP/issues/241

victorromeo commented 5 months ago

Papercut.smtp version 6.2.0.0 on Windows Server 2019 image

I just don't understand how these WebView2 processes consume so much CPU. I agree with the assumption of a memory leak, but the cause eludes me. The smtp service can hang occassionally, and I have to kill the process, to get it going again. Typically the locking issue happens after several days of use however, so diagnostic debugging isn't great at this point.

Jaben commented 4 months ago

I think this may have been fixed by PR #266

Payn commented 1 month ago

Memory consumption seems to be fixed now. Can't comment on CPU usage as i never had that issue.