• Frist (unregistered)

    hardfrist.exe

  • Primary Key (unregistered)

    Kill Frist

  • Primary Key (unregistered)

    Anyway, I agree on the appalling aspect. Giant leap from no connection to save to reboot. Work-around in the most possible way, hope that backup was arranged.

  • Quite (unregistered)

    ... um ... so ... er ... TRWTF is the hardwired magic number 10061, amirite?

  • Quite (unregistered)

    ... although I'm minded of a Dilbert from that sort of approximate vintage:

    1: Dilbert: "We could design the application using a simple point-and-click interface ..." 2: Dilbert: "... or we could require the user to select the correct one of a large number of poorly-documented text strings to be entered precisely at a command-line interface. 3: PHB: "Make it so it automatically reboots the computer at every typo."

  • martijntje (unregistered)

    What is this word 'brilliant' I see in the article? Shouldn't this be 'brillant'?

  • Steve_The_Cynic (nodebb)

    It is, indeed, leaning toward "appalling". That is, it is almost unbad enough to be merely appalling.

  • fristy (unregistered)

    But brillant means the same thing as brilliant

  • Gargravarr (unregistered)

    between "brilliant" and "appalling."

    Definitely "brillant".

  • PoPSiCLe (unregistered) in reply to Quite

    No, you're not right. While this is very close to appalling, if the machine is only running this app/webpage, and nothing else, forcing a reboot might actually be a working solution.

  • Appalled (unregistered)

    First off, it's Windows not Linux (exec("c:.......).

    Therefore the Server needs a Reboot every week or month since it WILL tie itself in knots eventually (it's Windows after all) and crash at the worst possible moment.

    PHP has no Scheduler, but you CAN call it from a DOS bat, and they wanted some intelligence behind the effort rather than a set of unattended Net Stop .....'s, so they wrote a PHP page to interrogate results and ensure that MySQL came down gracefully and checkpointed all its databases..

    They set up a Sunday 3:00 am Task Scheduler (weekly or monthly) to reboot the Server via a DOS/PHP script. Earlier in the script (or perhaps even back in the DOS bat) they shut down the MySQL instance running on the PHP Server. Now it's time to issue the reboot command via some silly homegrown, hardboot.exe.

    Why all the contrivances is beyond me. I can't call it brilliant but I can call it effective. Why not just humanly (watching it work) boot it at 6:00 am on a Monday when your earliest bird IT person arrives?

  • MaxArt (unregistered)

    Eh, I've seen worse, honestly. At least it's clear what they're doing and why, so after 16 years you can still know the full context.

  • Russell Judge (google)

    At least they're not rebooting the server by using another server's cup holder to push the reset button.

  • Bananafish (nodebb) in reply to Russell Judge
    At least they're not rebooting the server by using another server's cup holder to push the reset button.

    This was the first thing I thought of!

  • klg (unregistered)

    This is not just appaling, it's fucking retarded. SInce you are anyway calling an external process to do something, why not first query the SCM for the status of the MySQL service and do the appropriate restart/start whatever service-related action, before going full nuclear on the server.

  • hardboot (unregistered) in reply to klg

    Well, they did write a VB6 application to reboot the machine which could be due to 2 reasons:

    • they didn't know how to reboot from the command line and let VB6 do it. In that case you can't expect them to know what a SCM is let alone what it does
    • since VB6 interfaces slightly better with the windows API than PHP does maybe hardboot.exe does exactly that: check if the service is up and running running, try to bring it up if it isn't and restart the machine if it doesn't get up.

    I for one (if I would be malicious which of course I am not) would mess with the MySQL config files so the service won't come up upon restart or even better: change the listening port, then schedule a wget script to do a request on the script maybe every 2 minutes or so, but wouldn't restart the MySQL service. After a while maybe even due to a planned reboot of the machine (maybe Windows Update) the mayhem would start: the MySQL server fails to start (or the application can't connect), and the poor soul in charge of fixing the problem has no chance figuring out what's going on since the machine reboots every 2 minutes or so...MUAHAHAHAHAHAHA

  • Yazeran (unregistered) in reply to hardboot

    Now that's just eeevil grin

    Reminds me of the time (back in high school) when I rigged the stereo in the room to turn on for exactly 6 seconds every 5 minutes. The music started and the teacher got up to shut it off, but halfway towards the stereo it shut down by itself itself....

    Suffice to say, not much learning in that session....

    Yazeran

  • Yazeran (unregistered)

    The problem you describe with USB-serial is exactly why we use dedicated serial communications boards so that we KNOW which port numbers goes to what even after a reboot..... It may be more expensive, but keeping experimental set-ups running for years is hare enough as it is....

  • Herby (unregistered)

    This is obviously a well thought out and tested solution. I suspect that the guy who implemented it was an on-call guy that often got called in the middle of the night to "fix" the problem and was tired of being woken up. He programmed what he did manually to happen automatically, and let it go. For him it was ideal. It "fixed" the problem, and let him enjoy a full night's sleep. Win-win for all.

    That being said, is it the "proper" thing to do? Probably not. It is a bit extreme, and could get the object computer in a "really wedged" state requiring a site visit.

    Live & Learn.

  • Mike (unregistered)

    exec("c:\Progra~1\progs\comment.exe");

  • Klimax (unregistered) in reply to Appalled

    "Therefore the Server needs a Reboot every week or month since it WILL tie itself in knots eventually (it's Windows after all) and crash at the worst possible moment." Kindly, leave grossly outdated barely correct nonsense out. It might have been correct in 90s for 9x, but that's about that. (And don't act as if POSIX-stuff/POSIX-like stuff like Linux is any better...)

  • MrEricSir (unregistered)

    The unescaped backslashes in the string literal mean either this wasn't the real code, or it never worked in the first place.

  • ooOOooGa (unregistered)

    'brilliant' vs. 'appalling': To me this sounds like a DoS attack waiting to happen. In essence, web clients are capable of initiating a hard reboot on the server. All that is needed is a basic code injection vulnerability. Something as simple as an error message that reprints the user's invalid input.

    Hello server, my age is 'exec("c:\Progra~1\progs\hardboot.exe");' Server: invalid age. You entered Currently rebooting the server. Please try again in two minutes.

    Definitely appalling.

  • Yazeran (unregistered)

    Oh man, that is some weird string syntax.

    it basically prevents the addition of ANY new special escaped characters without breaking existing code!

    Not that I know which escaped character you you could possibly need to add, but artificially setting that limit; retarded language indeed..... (especially since they have already handled the backslash case with a double backslash anyway).

    When I see that one I just shudder to think what would happen if your string was something along this:

    $bar = "My string ?>";

  • Patrick (unregistered)

    If you suck so bad at admining servers that your PHP code runs with Administrator or SYSTEM privileges and thus can reboot the system, I am not at all surprised that you'd need a kludge like this. And I'm not surprised that someone would blame it on Windows instead of sheer incompetency either.

  • Brian Boorman (google) in reply to ooOOooGa
    To me this sounds like a DoS attack waiting to happen.

    I think you're making an assumption that this code was on a server that was visible to the external internet. That is not in evidence here. For all we know, it could have been in intranet server.

    If that were the case, it's not so much a DoS attack waiting to happen as it could be "some stupid employee getting himself fired" when they examine the log files and see which IP address was hitting the server over and over.

  • SmellTheDespair (unregistered)

    TRWTF is rebooting is overkill. Just terminate any hanging process (if it exists), then restart the service. If you're a real man, talk to the SCM directly, or wimp out and shell a "net start" command for the service that needs to be brought back to life.

  • Appalled (unregistered) in reply to Klimax

    What world are you living in? We still have 3 Windows 2003 (Domain, DB, and File) servers and 30% of 300 or so PC's are XP (they aren't allowed Internet Access and we applied the WannaCry patch to all). Naturally the 2003/XP's corrupt themselves eventually without a Reboot, but our new Win7/8/10's and a triplet of Windows 2008 Servers do (did) so as well. We do the Servers ourselves once a week. We TELL the PC Users to shut down at night, but they often neglect to. The solution to 5% of our Help calls is "When's the last time you rebooted?. Well give it a whirl and call us back if things are still broken"

  • dkf (nodebb) in reply to Yazeran

    Oh man, that is some weird string syntax.

    it basically prevents the addition of ANY new special escaped characters without breaking existing code!

    No, it's fine. Just use a / symbol to quote any problematic characters, since it isn't doing anything else.

    gd&r…

  • Sole Purpose of VIsit (unregistered) in reply to Appalled

    The relevance of the "30% of 300 or so PC's are XP" somehow escapes me. Apart from any other grotesque WTFery, you're not actually talking about servers, let alone an ancient MySQL issue.

    Look. Anybody who thinks that shelling out to a hard reboot of a server, under any circumstances whatsoever, is an acceptable solution to the loss of a connection is ... and I say this with due deliberation ... far more stupid than even the most cretinous manager I have ever encountered.*

    The OS has nothing to do with it. Anybody who has ever had to clean up a mangled file system after such an idiotic (and presumed repeated) "solution" will have your guts for garters.

    *Props to the moron in question for adding a comment that describes, in disturbing detail, quite what a lunatic he is, however.

  • Dan (unregistered)

    TRWTF is using a home-grown reboot solution instead of "rundll32.exe shell32.dll,SHExitWindowsEx 6"

  • Appalled (unregistered)

    Th OS has EVEYTHING to do with it. There is NO SUCH THING as a Windows machine that can go longer than a month or two non-stop without Corrupting it's memory and trashing everything that's running on it, including itself. Boot once a month or crash. End of story.

  • Patrick (unregistered)

    Stuck in Windows 95 perhaps? I have had lots of Windows servers with two or three year uptimes. And while most others reboot somewhat regularly due to updates, they have literally zero crashes or any other unscheduled need for rebooting...

  • Watson (nodebb)

    To be fair, in 2001 MySQL was a stability issue.

  • derp (unregistered) in reply to Appalled

    I've not got any particular like for any of the top OSes, but I've run windows servers without reboots for months at a time without a single hickup. I even kept a win95 computer running past when the time wrapped around itself a couple of times mostly to test it. Windows has a god awful UI, but it's not that horribly broken that it cant be left to it's own devices for months on end. If your windows servers shit themselves in a month, you have shitty software running on the servers. Or shitty admins of said servers.

  • urkerab (nodebb) in reply to Dan

    Why abuse rundll32.exe when you can invoke shutdown.exe?

  • nasch (unregistered) in reply to Appalled

    I know it's just spambots now but I had to chime in - I also administer a Windows server that can generally go months at a time without a reboot.

  • dime (unregistered) in reply to Quite

    It's the error number. That said, they're an idiot for not using mysql_errno.

  • dime (unregistered) in reply to Dan

    Just gonna leave this here...

    C:\Windows\system32>shutdown /? Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

Leave a comment on “Hard Reboot”

Log In or post as a guest

Replying to comment #:

« Return to Article