What are all the ways that a SELECT statement could be made to not terminate or take a *very* long time?
MariaDB-10.1.1 has max_statement_time to abort long-running statements.  I don't think MySQL has anything equivalent.
(Of course, you need at least 10.2 to get Recursive CTEs.)