LACK_OF_CPU shutdown means your application sustained CPU usage beyond the limit allocated to its container, and Virtus Cloud terminated the process to protect platform-wide stability. CPU resources are shared across all applications running on the same server, and a single application that continuously pegs the CPU at 100% degrades the experience for every other tenant. This guide explains what causes LACK_OF_CPU errors and how to resolve them — either by optimizing your code or by upgrading to a plan with a higher CPU ceiling.
When Does It Occur?
You’ll see the following message in your application logs when the platform enforces the CPU limit:Why Does It Occur?
Your application is using more CPU than its container is permitted to consume. This can happen because:- Your application runs an inefficient algorithm that doesn’t complete in a reasonable time under load.
- A tight loop is executing without any
awaitorsleepcall, preventing the event loop from yielding. - You’re processing a large volume of events or messages simultaneously without any concurrency limit.
- Your application includes functionality that mines cryptocurrency or performs other prohibited sustained-compute workloads.
How to Fix It
Optimize Your Application’s CPU Usage
Before upgrading your plan, review your application’s code for common CPU inefficiencies:Add delays to polling loops
Add delays to polling loops
If your application periodically checks a condition in a loop, make sure it yields control between iterations. In Node.js, use
await new Promise(r => setTimeout(r, ms)). In Python, use await asyncio.sleep(seconds).Throttle high-frequency event handlers
Throttle high-frequency event handlers
If your bot or API receives a high volume of events, process them in batches or use a queue with a concurrency limit rather than handling every event synchronously.
Profile and eliminate hot paths
Profile and eliminate hot paths
Use Node.js’s built-in profiler (
node --prof) or Python’s cProfile module to identify which functions consume the most CPU time. Optimize or cache the results of expensive computations.Offload CPU-heavy work
Offload CPU-heavy work
Move computationally intensive tasks — image processing, large dataset aggregation, cryptographic operations — to a separate worker thread (Node.js
worker_threads) or process pool (Python multiprocessing), rather than blocking the main event loop.Upgrade Your Plan
The CPU available to your application is determined directly by your plan tier. If your application’s workload is legitimate but simply exceeds what your current plan provides, upgrading is the correct solution.Review available plans
Visit the Virtus Cloud pricing page and compare the CPU allocations across plan tiers.
Upgrade your plan
Select the plan that provides sufficient CPU for your workload and complete the upgrade from the dashboard.
If you continue to experience
LACK_OF_CPU shutdowns after upgrading and optimizing your code, contact the Virtus Cloud support team for further assistance.