High CPU due to request spam to /cometd/connect
See original GitHub issueI’ve noticed that the material skin page causes high CPU usage (>30% on my laptop) since 1.5.0
This is due to the code constantly spamming long-polling POSTs to /cometd/connect
Looking at the response payload, I’d assume that this is caused by the server responding with "advice":{"interval":0}
[
{
"channel":"/meta/connect",
"clientId":"65f180ab",
"successful":true,
"timestamp":"Sun, 29 Mar 2020 09:40:41 GMT",
"advice":{
"interval":0
}
},
{
"id":"8",
"data":[
"prefset",
"server",
"playingAtPowerOff",
"0"
],
"channel":"/65f180ab/slim/playerprefs/00:04:20:1f:6f:7c",
"ext":{
"priority":""
}
},
{
"channel":"/65f180ab/slim/playerprefs/00:04:20:1f:6f:7c",
"id":"8",
"data":[
"prefset",
"server",
"playingAtPowerOff",
"1"
],
"ext":{
"priority":""
}
},
{
"channel":"/65f180ab/slim/playerprefs/00:04:20:1f:6f:7c",
"data":[
"prefset",
"server",
"playingAtPowerOff",
""
],
"id":"8",
"ext":{
"priority":""
}
}
]
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Troubleshooting | Comet Documentation
This message means the connection was corrupted over the network, and Comet's network library closed the connection. This can happen because of random ......
Read more >High CPU usage for "sa-learn" and "spamtrain" processes in a ...
Resolution. To work around the issue, use one of the following solutions: Create a wrapper script that will launch sa-learn with low priority:...
Read more >Scalable COMET Combined with ASP.NET - CodeProject
An article describing a scalable method of using persistent AJAX connections (A.K.A. COMET) with ASP.NET.
Read more >High CPU usage - WordPress.org
Hello, I have an issue with a high CPU load. ... The problem with big SQL request related to the security plugin is...
Read more >ASP.NET HttpWebRequest stop sending requests, high CPU ...
We send out httpWebRequest to a remote REST server and retrieve XML back, most of the time the application works fine. Recently, we...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
…if you do install the git version of Material, edit
server.js
and change line 263 fromthis.cometd.init({url: '/cometd', logLevel:'off'});
tothis.cometd.init({url: '/cometd', logLevel:'debug'});
- then reload Material. This will enable libcometd’s debug, and might provide useful information.It happened again.
While there’s nothing in the js console (even with the debug GET parameter), I did get a lot of output on the server-side after setting
network.cometd
to debug logging.Restarting the server did resolve it again (for now)
The interesting part seems to be
Sending long-poll response immediately
which doesn’t seem to appear anymore after the restartInstead we’re seeing this, which apparently happens when the cometd manager thinks that the client has pending events https://github.com/Logitech/slimserver/blob/6a8d6f13f0e791cb004dc5ac8db99f51bb93ef22/Slim/Web/Cometd.pm#L298
The pending event is (at least in this case) this one loop:
which gets spammed constantly. https://github.com/Logitech/slimserver/blob/24e364a1813614378f73529a09845f896de407ff/Slim/Player/Player.pm#L232 The player in question was playing a webradio stream before yesterday and has been idle ever since. After the LMS restart, the playlist for the player was restored to local media only.
Not entirely sure what’s happening here but I suppose it’s not an issue with the material skin after all.