Coder Social home page Coder Social logo

BUG:Abnormal high CPU usage about webproc HOT 22 OPEN

jpillora avatar jpillora commented on July 30, 2024
BUG:Abnormal high CPU usage

from webproc.

Comments (22)

xczh avatar xczh commented on July 30, 2024

@jpillora I need help, thanks :)

from webproc.

jpillora avatar jpillora commented on July 30, 2024

from webproc.

xczh avatar xczh commented on July 30, 2024

No, the log frequency is about 1 line/s.

And this phenomenon is only recently. Before, I used v0.3.0 version to run stably for nearly a year, and did not find this problem. I upgraded to version v0.4.0 the day before yesterday, and this problem occurred two days after running.

from webproc.

xczh avatar xczh commented on July 30, 2024

In order to eliminate the problem of dnsmasq, I rerun the program. I used mpstat 1 to print out the CPU utilization per second, and found a very interesting phenomenon.

# webproc -c /etc/dnsmasq.conf -p 80 --user test --pass 123456 -- mpstat 1

image

After the program runs for 2 minutes, the CPU utilization rate is still as high as 100%.

These are mpstat output:

⁣09:22:39     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:22:40     all    0.00    0.00    0.00    0.00    0.25    0.25    0.00    0.00   99.50
⁣
⁣09:22:40     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:22:41     all    0.00    0.00    0.25    0.00    0.00    0.00    0.00    0.00   99.75
⁣
⁣09:22:41     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:22:42     all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

......

⁣09:24:24     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:25     all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
⁣
⁣09:24:25     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:26     all    0.00    0.00    0.00    0.00    0.00    0.25    0.00    0.00   99.75
⁣
⁣09:24:26     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:27     all    0.00    0.00    0.25    0.00    0.00    0.00    0.00    0.00   99.75
⁣
⁣09:24:27     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:28     all    4.52    0.00    0.50    0.00    0.25    0.00    0.00    0.00   94.72
⁣
⁣09:24:28     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:29     all   16.08    0.00    1.51    0.00    0.50    0.50    0.00    0.00   81.41
⁣
⁣09:24:29     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:30     all    0.25    0.00    0.00    0.00    0.25    0.00    0.00    0.00   99.50
⁣
⁣09:24:30     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:31     all   18.30    0.00    3.51    0.00    0.50    0.00    0.00    0.00   77.69
⁣
⁣09:24:31     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:32     all   17.97    0.00    0.51    0.00    0.51    0.00    0.00    0.00   81.01
⁣
⁣09:24:32     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:33     all   17.88    0.00    0.76    0.00    0.76    0.25    0.00    0.00   80.35
⁣
⁣09:24:33     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:34     all   18.18    0.00    0.76    0.00    0.51    0.00    0.00    0.00   80.56
⁣
⁣09:24:34     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:35     all   19.10    0.00    0.50    0.00    0.75    0.00    0.00    0.00   79.65
⁣
⁣09:24:35     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:36     all   19.24    0.00    0.76    0.00    0.51    0.00    0.00    0.00   79.49
⁣
⁣09:24:36     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
⁣09:24:37     all   18.94    0.00    0.76    0.00    0.76    0.00    0.00    0.00   79.55

Since then, CPU usage has remained at this level.

@jpillora

from webproc.

jpillora avatar jpillora commented on July 30, 2024

from webproc.

xczh avatar xczh commented on July 30, 2024

I just executed this command:

webproc -c /etc/dnsmasq.conf -p 80 --user test --pass 123456 -- mpstat 1

and then open the browser to access: http://localhost.

mpstat 1 prints CPU usage every second.

from webproc.

jpillora avatar jpillora commented on July 30, 2024

from webproc.

xczh avatar xczh commented on July 30, 2024

Exactly. I find that if I don't open the browser, the CPU usage is always less than 0.5%. Once you open your browser, it's 100% in a flash. But why is that?

Will JavaScript scripts affect the CPU utilization of the server?

from webproc.

jpillora avatar jpillora commented on July 30, 2024

from webproc.

xczh avatar xczh commented on July 30, 2024

Fedora 33, amd64

from webproc.

jpillora avatar jpillora commented on July 30, 2024

from webproc.

xczh avatar xczh commented on July 30, 2024

In addition, I suggest adding the net/http/pprof HTTP endpoint to facilitate troubleshooting.

from webproc.

xczh avatar xczh commented on July 30, 2024

It seems that this problem does not exist in v0.3.0. Can I switch back to the old version? What are the disadvantages?

from webproc.

jpillora avatar jpillora commented on July 30, 2024

from webproc.

xczh avatar xczh commented on July 30, 2024

image

I was wrong. Just now, I spent more than an hour retesting the v0.3.0 version and found that the leak still exists. CPU usage is increasing at a very slow rate, but it does continue to increase. This can lead to problems that are hard to detect and I've ignored in the past year.

In the version of v0.4.0, the CPU consumption increases rapidly when using the browser to access the page, which leads to the problem being found quickly.

This problem looks SERIOUS and needs to be fixed. Before the problem is solved, I think I can only disable webproc.

Or are there any effective measures?

from webproc.

jpillora avatar jpillora commented on July 30, 2024

from webproc.

Schwobaland avatar Schwobaland commented on July 30, 2024

I have the same problem. Setting the max-lines to 100 didn't help...

from webproc.

jpillora avatar jpillora commented on July 30, 2024

from webproc.

Schwobaland avatar Schwobaland commented on July 30, 2024

Arm64. What helped, was disabling the logs for the webui - with the downside of missing logs in the webui.
-l proxy

By the way - thanks for creating webproc!!

from webproc.

rinex20 avatar rinex20 commented on July 30, 2024

I had the same issue like above. @jpillora
ubuntu x86_64.

from webproc.

rinex20 avatar rinex20 commented on July 30, 2024

I had the same issue like above. @jpillora ubuntu x86_64.

finally,
downgrade to 0.3.3 to fix this high cpu usage.

from webproc.

ThorstenKunz avatar ThorstenKunz commented on July 30, 2024

Same issue with 0.4.0. I added "-l proxy" and that solved it. Running on
Linux raspberrypi 5.4.0-1066-raspi #76-Ubuntu SMP PREEMPT Mon Jun 27 11:02:52 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

from webproc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.