question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CPU Leak in botRateLimiter

See original GitHub issue

Yesterday, I put my JDA 3.0 version of ErisBot live for around 40 minutes. I did this to catch any errors pre-launch.

During the test I noticed my CPU was maxed out for no reason. I loaded up VisualVM and found com.neovisionaries.ws.client.WebSocketInputStream.readBytes() completely chewing on the CPU.

I did some further testing to then find net.dv8tion.jda.core.requests.ratelimit.botRateLimiter$Bucket.run() was also be doing the same (not in production, just testing)

In testing, I created a for loop and queued 50 messages which is what caused the ratelimiter to eat the cpu. It was eating around 20% of my overall CPU (i7-6700k) which shouldn’t even be possible for queuing 50 messages.

Here are some screenshots: http://i.imgur.com/VOXLLB7.png - Overall CPU usage http://i.imgur.com/4IJmwX4.png - Messages from the queue http://i.imgur.com/1KYIzim.png - The top CPU usages http://i.imgur.com/eWIISOe.png - JVM CPU Usage (Spikes are when the messages were sent) http://i.imgur.com/knr4K1F.png - Thread spike when flooding the channel (Can’t replicate, unsure what the cause of this was)

I would also like to note that I did the same test on another JDA bot, which is designed completely different due to it’s private use. I received the exact same results.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TheEpTiccommented, Dec 12, 2016

Can confirmed it’s fixed. Good job!

0reactions
DV8FromTheWorldcommented, Dec 12, 2016

I believe this is fixed as of cdd5c609f289e33ef16dc6b5ff6d4fe4d68782c6

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix high Java CPU usage problems - TheServerSide.com
One of the first indicators of a runtime performance problem is a high Java CPU usage report from a JVM profiler or Java...
Read more >
No CPU usage metrics? #4986 - GitHub
Yes, I'd like to monitor the CPU usage of my application. OTEL has memory pool instrumentation, so it'd be nice to have CPU...
Read more >
High cpu usage and memory leak - java - Stack Overflow
I would like to reduce CPU usage at least to an acceptable level and what much more important i wanna get rid of...
Read more >
Troubleshooting High CPU and Memory Leaks in Java ...
Discover the ultimate troubleshooting guide to resolve high CPU utilization and memory leaks in any Java Application.
Read more >
High Java CPU Usage – Troubleshooting Tips - eG Innovations
Resolve common high Java CPU usage issues including CPU spikes, timing issues and other problems that impact Java application performance.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found