@nebulon said in How do you diagnose PHP-based SQL problems?:
@lonkle just to be on the same page, since this sounds far out with some plugin spawning a mysql process. The logs you have pasted earlier here, are those from the app or from the mysql service running in your Cloudron?
That is from the my SQL logs. I found out that's why the entire server would stop functioning for 5 minutes at a time - MySQL unexpectedly dies, retries, dies, retries, dies. I know it's gotta be a plugin. When you said it was spawning an SQL process somehow, I just ran with the idea since you're the expert but I realized that you just thought I was showing you app logs.
I'v watched the app logs even during one of the random MySQL deaths, and there's nothing on the logs except normal PHP stuff. I cleaned up all the notices and it still happens. I have ONE lead:
PHP Notice: Undefined offset: 1 in phar:///app/pkg/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 70
I don't use the WP-CLI, which means it can only be that the 1 minute
cron job set up that sometimes runs into some huge task. Something is throwing an undefined offset in the Cron anyway. I'm hoping that's it. If I can find it. 
I'll have to time the next time it happens and see if it aligns with a cron job.