WHMCS - Cron Job Never Completes 502 Error
WHMCS is a pile of rank garbage.
Aside from that, here is the issue I saw today.
Running the cron in /admin/cron.php was causing a 502 bad gateway error. Looking at logs it seems that part of the cron was completing but not all of it (updating stats, backups, etc).
The cause seems to be that if you have a server set to active, and the server is down, then the cron will wait and wait and wait and eventually throw the error.
Since WHMCS doesn’t do a simple ping test or connection test to the server to see if it should even be accessed, the only way to bypass this issue is to disable the server on the servers page.
After doing so, the cron should run as expected.