Article 2QADJ CodeSOD: Hard Reboot

CodeSOD: Hard Reboot

by
Ellis Morning
from The Daily WTF on (#2QADJ)

500px-Reset_button.svg.png

Every day in IT, each one of us walks the fine line between "brilliant" and "appalling." We come across things that make our jaws drop, and we're not sure whether we're amazed or horrified or both. Here's a PHP sample that Brett P. was lucky-or unlucky-enough to discover:

This comes from circa 2001, back when there were MySQL stability issues on a server. If in response to the end user's request the script couldn't connect to the session database, PHP would shell out to a VB6 .EXE that rebooted the machine. Ta dum! No more connection error!
if (strpos(mysql_error(), "connect to MySQL server on 'localhost' (10061)")) { // The MySQL Error: Can't connect to MySQL server on 'localhost' (10061) // means that the MySQL database is not running. This is caused by a failed // reboot. Since MySQL is not running, it is safe to execute a hard boot. echo "Currently rebooting the server. Please try again in two minutes."; flush(); exec("c:\Progra~1\progs\hardboot.exe");}

That comment block full of flimsy assumptions and unwarranted confidence makes my insides knot up with dread. I'm leaning toward "appalling" on this one. Anyone else?

puppetlabs50.png[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today! TheDailyWtf?d=yIl2AUoC8zANDCR-y4jgLk
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments