• (cs) in reply to reverendryan
    Anonymous:
    Anonymous:
    Keyboard not found! Press any key to continue...


    Actually, that makes perfect sense. The BIOS is giving you an opportunity to plug a keyboard in (when it will still be recognized) before your OS boots and simply assumes that there is never going to be a keyboard.   Especially usefull back in the day when plugging in a keyboard would crash DOS/Windows.


    Pulling out and plugging in a keyboard on an XT machine (who remembers them?) while the power was on was a guaranteed way to instantly fry the motherboard. I have actually seen this happen when somebody who didn't believe me tried it out on a office computer.


  • (cs) in reply to Pyromancer

    Pretty funny. This is why you always write your error logs to a text file. If it makes you happy, make it an XML text file. If your system is so borked that you can't even write to a text file, chances are you don't need to look at a log file.

    I can see why it'd be tempting to use SQL, but just because you have a big sexy tool, doesn't mean it's the right one for every job.

  • (cs) in reply to ParkinT
    ParkinT:

    Infinite Recursion n. see loop

     

    Loop n. see Infinite Recursion

     

     

    Is there another word for "Thesaurus"?

    Straight out of dictionary.com:

    thesaurus

    n : a book containing a classified list of synonyms [syn: <FONT color=#0033ff>synonym finder</FONT>]

    synonym finder

    n : a book containing a classified list of synonyms [syn: <FONT color=#000099>thesaurus</FONT>]

     

    <!-- google_ad_region_end=def --><!-- google_ad_region_end=def -->
  • (cs)

    Simply put: This is why global variable scope is evil.

  • StupidPeopleTrick (unregistered) in reply to Pyromancer

    diskpart.exe

       sel dis 0

       sel par 0

       inactive

       exit

    shutdown.exe -r -t 1

    that will fix everything....

    - SPT

  • Junior IT Professional (unregistered)

    The real WTF is how a bunch of IT professionals can never agree on what the real WTF is, EVER!

  • Auric (unregistered) in reply to Pyromancer

    New Company Policy:

    For All Network related issues, please submit via the online help desk system.
    For All phone related issues, please call the telecom manager at ext. 123


  • (cs)
    Alex Papadimoulis:
    function executeQuery(...) { writeErrorToLog(); }
    function writeErrorToLog(...) { executeQuery(); }
    

    <FONT color="#ffa500" size=6>"Concentrated WTF.  Now with Calcium!"</FONT>

    [:P]

  • qbolec (unregistered) in reply to Frikkie

    So..the whole problem with the code is the missing single-quote.

    I mean: if your database cannot serve even simple insertion, then why to log anything - you're doomed.

    It's easy to repair the whole thing so there's no recursion...but what for...

    Obviously the code wasn't tested...and the administrator was lazy....

    :b

     

  • barfo (unregistered) in reply to Pyromancer

    This is about as good as a routine shipping in a popular-commercial-software-package-which-shall-remain-nameless that does this pseudocode:

    sub generate_alert( msg) {
      send_alert_email( recipient, msg); # notify someone of problem
      write_alert_to_database( msg); # keep a record for posterity
    }

    event_loop (every 5 minutes) {
      if (database.checkFreeSpace < minimumFreeSpaceThreshold) {
        generate_alert( "Alert: free space is below minimum")
      }
    # ... [deletia] ...
    }

     

  • (cs) in reply to TankerJoe
    TankerJoe:
      I = BigButts.like() && I.lie(false);
    

    <FONT face=Georgia color="#a52a2a" size=6>Cool sig. Sir Mix-A-Lot, no?</FONT>

    [8-)]

  • (cs) in reply to Tei
    Tei:
    I see a sql inyection, because the SQL is never quoted with mysql_real_quote or something alike. Or this guys will use some magic php feature that will aturdetect smoke?


    PHP calls it "magic_quotes."  I would link to it in the online manual but the forum software isn't letting me create links.  Here's the URL: http://www.php.net/magic_quotes
  • (cs)

    This WTF reminds me - I really need to add a set of "safe" error-printing routines to InitNG (since the normal error message handling routines call several hooks, some of which run marginally interesting code involving sockets which may wish to report an error itself but can't for obvious reasons).

    Anyway, as you might've guessed, I once did something similar to this (though slightly harder to spot) myself... fortunately, I caught it (or more precisely, the crash it caused when I was trying out my shiny new code) before it could cause any real problems, and The Daily WTF doesn't generally feature open-source software anyway.

  • Stickler (unregistered) in reply to Bus Raker
    Bus Raker:
    ParkinT:

    Infinite Recursion n. see loop

     

    Loop n. see Infinite Recursion

     

     

    Is there another word for "Thesaurus"?

    Straight out of dictionary.com:

    thesaurus

    n : a book containing a classified list of synonyms [syn: <font color="#0033ff">synonym finder</font>]

    synonym finder

    n : a book containing a classified list of synonyms [syn: <font color="#000099">thesaurus</font>]

     

    <!-- google_ad_region_end=def --><!-- google_ad_region_end=def -->

    This dictionary.com example isn't really an example of a circular (recursive, etc) definition, since they are not defined in terms of eachother.  Of course every word in a group of synonyms is going to list the other as a synonym, but that doesn't make it circular.  the definition is just the same, and it is very non-circularily defined in terms of other words.
  • Senior IT Professional (unregistered) in reply to Junior IT Professional
    Anonymous:
    The real WTF is how a bunch of IT professionals can never agree on what the real WTF is, EVER!

    I am going to have to respectfully, but vehemently, disagree.
  • McTesty (unregistered)

    Doh.  This is the first DWTF that I've actually done before.

    :$

  • (cs) in reply to McTesty

    Reminds of Horde: logs an error under many conditions. Logging an error means opening the log file. Opening the log file may fail (file permissions, safe_mode).

    At least the Horde developers do know it's a WTF:

    • a comment "to understand recursion, you need to first understand recursion" in one of the functions that can fail
    • a recursion counter limited to 25
  • (cs) in reply to TomCo
    TomCo:
    TankerJoe:
      I = BigButts.like() && I.lie(false);
    

    <font color="#a52a2a" face="Georgia" size="6">Cool sig. Sir Mix-A-Lot, no?</font>

    [8-)]



    Indeed,  but I have to admit that I stole it from someone else.
  • (cs) in reply to OpBaI

    C'mon, you nay-sayers.  That was funny!  I don't even know SQL and I got a laugh out of that one.

    My favorite error-reporting code was deep in one of our GUI-based products, written in MFC (Microsoft's C++ wrappers for the Win32 library), in some parsing code written by an intern at the time.  If the user script had entered a statement that didn't parse, the following code block executed (with the attached comment in source):
    {
      // parsing error, quit gracefully
      exit (0);
    }

    Yes, that will quit.  Gracefully?  Depends on ones point of view, I suppose.

  • (cs) in reply to X-Phile
    X-Phile:
    Yes, when the phonelines go dead, I quickly get on the phone to call the phone company to let them know.

    He must have left the position to move on to management.


    Actaully .... I rang up my ISP a few months ago when I was having problems connectin to the internet and I got a recorded message telling me to email support@digiweb.ie.

    I'm sure their suport team have a very easy time ... "if you can't connect to the internet .... user the internet to tell us to fix your internet connection".  A level of 'logic' I never quite got .... however the idiot who wrote the code above seems to be right on their wavelength!
  • Rophuine (unregistered) in reply to Shen
    Shen:
    Writing errors to a database, though? Seriously, there's nothing wrong with using plain text flat files for things like this.

    Or XML ducks



    And what, exactly, is wrong with a fail-safe flat text file critical error log? Unlike databased logs, I have never been unable to write to a flat text file due to network layer problems, unmatched quotes, incorrect data formats, fubared SQL syntax, table structure changes, failure to include a required field, exceeding the maximum length of a field, or a crashed database backend.

    If you can't write to a flat file, your troubles are already deep enough that you don't care if a single query failed to execute.

  • Tin in Australia (unregistered) in reply to Frikkie
    Frikkie:
    Pulling out and plugging in a keyboard on an XT machine (who remembers them?) while the power was on was a guaranteed way to instantly fry the motherboard. I have actually seen this happen when somebody who didn't believe me tried it out on a office computer.


    It didnt kill my XT... Although it was a clone, not a real XT.
    The XT boxes my high school had (also clones) had a huge automotive style fuse near the keyboard connector, which I guess is an attempt at protecting the board from such things.
  • .* (unregistered) in reply to Rophuine
    Anonymous:
    Shen:
    Writing errors to a database, though? Seriously, there's nothing wrong with using plain text flat files for things like this.

    Or XML ducks



    And what, exactly, is wrong with a fail-safe flat text file critical error log? Unlike databased logs, I have never been unable to write to a flat text file due to network layer problems, unmatched quotes, incorrect data formats, fubared SQL syntax, table structure changes, failure to include a required field, exceeding the maximum length of a field, or a crashed database backend.

    If you can't write to a flat file, your troubles are already deep enough that you don't care if a single query failed to execute.

    Why yell at him? He agrees with you.

  • (cs) in reply to Cooper
    Cooper:
    Anonymous:

    >>An oversight like this isn't a WTF, sheesh.

    The WTF isn't the code. The WTF is that the previous maintenance developer didn't investigate and just rebooted the server any time there was an error that triggered the error trap infinite loop.



    That is not a WTF - it is petty incompetence entrained into a support person by our Microsoft-PC environment.

    Good people - the criteria for acceptance as a WTF is going south in a hurry.

     

    "Honey we are out of note paper..."

    "Ok write me a note, I'll get some next I go to the store."

    Yes the code itself is a WTF, lets see we can't write to the database, so lets log the error to the database.

    The attitude of the previous guy is also a WTF. It failed, I dunno reboot.

  • (cs) in reply to StupidPeopleTrick
    Anonymous:

    diskpart.exe

       sel dis 0

       sel par 0

       inactive

       exit

    shutdown.exe -r -t 1

    that will fix everything....

    - SPT

     

    <FONT style="BACKGROUND-COLOR: #ffff00" face=Verdana color=#ff1493 size=6>*veryNullPointerToMemoryLoss = malloc(null);</FONT>

    <FONT style="BACKGROUND-COLOR: #ffff00" face=Verdana color=#ff1493 size=6>if(computerNotResponding(*veryNullPointerToMemoryLoss)) reboot();</FONT>

    [8-)]

  • (cs) in reply to Arne

    Anonymous:
    How often does your MySQL server fail right in the middle of script execution? He could have added a different error handler for when mysql_connect() fails and with the above code he wants to log any queries that might fail for whatever reason.

    Oh yeah, MySQL is the most stable thing on this world and nothing can crash it once you get it working, eh? 

    The real WTF for me is why error log goes to a database and not to a text file - the possibility to crash a database is far from comparable to being unable to write something to a file. If the disk is full then both will crash anyway.

  • Bekar (unregistered) in reply to JudoPolecat
    Anonymous:
    Anonymous:

     $sqlText =
    "INSERT INTO errorLog (ownerID,time,description,script) " .
    "VALUES ('" . $owner . ",Now(),'" . $description . "','" . $script . "')";

    isn't an apostrophe missing?

     "INSERT INTO errorLog (ownerID,time,description,script) " .
    "VALUES ('" . $owner . <FONT style="BACKGROUND-COLOR: #7fffd4">"<FONT color=#ff1493>'</FONT>,Now</FONT>(),'" . $description . "','" . $script . "')";

    Actually, you're on to something...  executeQuery might fail for reasons other than connectivity, so it's not a WTF to log an error to the database.  The WTF is that the code that logged an error to the database was not well-tested, and not robust.  If anything should be robust, it should be your error-handling...

    Not really. Look closer:

    "INSERT INTO errorLog (ownerID,time,description,script) " .
    "VALUES (<FONT style="BACKGROUND-color: #7fffd4"><FONT color=#ff1493>'</font>"</font> . $owner . <FONT style="BACKGROUND-COLOR: #7fffd4">"<FONT color=#ff1493>'</FONT>,Now</FONT>(),'" . $description . "','" . $script . "')";

    The same is done around the $description and $script portions.

  • Bekar (unregistered) in reply to Bekar

    Ack! Again, without markup..

    "INSERT INTO errorLog (ownerID,time,description,script) VALUES ( ' " . $owner . " ' ,Now(),'" . $description . "','" . $script . "')";

  • Jolly Roger (unregistered) in reply to Pyromancer

    The real WTF is some people in the forum calling the infinite RECURSION, an infinite loop ...

  • (cs) in reply to Jolly Roger
    Anonymous:
    The real WTF is some people in the forum calling the infinite RECURSION, an infinite loop ...


    Technically, you are right. So what?
  • (cs) in reply to Satanicpuppy
    Satanicpuppy:
    just because you have a big sexy tool, doesn't mean it's the right one for every job.


    For instance, women with small mouths.
  • (cs)

    Why is everyone going on about PHP? Isn't this Perl? Aside from that, yeah, we've all done this. The only question is how long did it take us to spot and fix the mistake....

  • (cs) in reply to reverendryan

    Anonymous:
    Anonymous:
    Keyboard not found! Press any key to continue...


    Actually, that makes perfect sense. The BIOS is giving you an opportunity to plug a keyboard in (when it will still be recognized) before your OS boots and simply assumes that there is never going to be a keyboard.   Especially usefull back in the day when plugging in a keyboard would crash DOS/Windows.

    With that kind of attitude we'll be in the dark ages in the IT business forever.

    The simplest heuristic would be to look at it from a newbie point of view.

  • H (unregistered)

    Is'nt the WTF the use of PHP?

     

    /H

  • (cs) in reply to H

    The WTF is the yanks, yet again!

    I also like return "", so call the infinite loop and if you ever escape it ensure you return an notnull empty string.


  • (cs) in reply to ammoQ

    ammoQ:
    Anonymous:
    The real WTF is some people in the forum calling the infinite RECURSION, an infinite loop ...


    Technically, you are right. So what?

     

    ehhh it's very different... that's what... With infinite Recursion you're bound to get a stack overflow at some point, with an infinite loop that is not necessarily so.

  • (cs) in reply to Junior IT Professional
    Anonymous:
    The real WTF is how a bunch of IT professionals can never agree on what the real WTF is, EVER!


    The real WTF is that we're not IT professionals. :)

    (Anyway, this "error in the error handler" problem is a fairly common antipattern, it should be taught in school.)
  • (cs) in reply to jannes
    jannes:

    ammoQ:
    Anonymous:
    The real WTF is some people in the forum calling the infinite RECURSION, an infinite loop ...


    Technically, you are right. So what?

     

    ehhh it's very different... that's what... With infinite Recursion you're bound to get a stack overflow at some point, with an infinite loop that is not necessarily so.



    Not always. See http://en.wikipedia.org/wiki/Tail_recursion, though this is not such a case.

  • (cs) in reply to tomandlu

    tomandlu:
    Why is everyone going on about PHP? Isn't this Perl?

    Nope. Perl uses 'sub', not 'function'.

  • Paul (unregistered)

    Made me laugh, after the penny dropped.

  • (cs) in reply to Bus Raker
    Bus Raker:
    ParkinT:

    Infinite Recursion n. see loop

     

    Loop n. see Infinite Recursion

     

     

    Is there another word for "Thesaurus"?

    Straight out of dictionary.com:

    thesaurus

    n : a book containing a classified list of synonyms [syn: <FONT color=#0033ff>synonym finder</FONT>]

    synonym finder

    n : a book containing a classified list of synonyms [syn: <FONT color=#000099>thesaurus</FONT>]

     

    <!-- google_ad_region_end=def --><!-- google_ad_region_end=def -->

    Thank you.

    But that is not ONE word.[+o(]

  • (cs) in reply to ammoQ
    ammoQ:
    jannes:

    ammoQ:
    Anonymous:
    The real WTF is some people in the forum calling the infinite RECURSION, an infinite loop ...


    Technically, you are right. So what?

     

    ehhh it's very different... that's what... With infinite Recursion you're bound to get a stack overflow at some point, with an infinite loop that is not necessarily so.



    Not always. See http://en.wikipedia.org/wiki/Tail_recursion, though this is not such a case.

    thnx for the link, but still it's different recursion (even tail) and an iterative loop, though they sometimes can be translated from one to the other:

    from Wikipedia:

     tail recursion is a special case of recursion that can be easily transformed into an iteration. Such a transformation is possible if the recursive call is the last thing that happens in a function. Replacing recursion with iteration, either manually or automatically, can drastically decrease the amount of stack space used and improve efficiency.

     

  • tominich (unregistered) in reply to ParkinT

    I don't know, but do you know what 'dictionary' means and where I can find out ?

  • Bart (unregistered) in reply to Colin
    Anonymous:
    Hardly a WTF at all.  Slap a check for if not connected then log with error_log() or just bail.

    You must be a PHP programmer. You didn't see that the whole original SQL statement is inserted into a new SQL statement, without any escaping (backslashes, anyone?) at all. I'm quite sure there will hardly ever be a case where this will be successful. And then, it'll invoke itself for the new error...

  • bob (unregistered)

    anyone want to explain what the Die function does? Is that the basis of the WTF? Because otherwise, I don't see why it'd hang since the DB could be down for a second and then come back up, the bad query gets logged at that point and everything continues...

    But logging to the DB is prob not a great idea for this reason,

  • codeman (unregistered) in reply to StupidPeopleTrick
    Anonymous:

    diskpart.exe

       sel dis 0

       sel par 0

       inactive

       exit

    shutdown.exe -r -t 1

    that will fix everything....

    - SPT

    You know, some of the lesser evolved sys-admin's out there might think you are serious - granted, they might get what they deserve, but so would unsuspecting developers who might otherwise know better.

  • (cs) in reply to reverendryan
    Anonymous:
    Anonymous:
    Keyboard not found! Press any key to continue...


    Actually, that makes perfect sense. The BIOS is giving you an opportunity to plug a keyboard in (when it will still be recognized) before your OS boots and simply assumes that there is never going to be a keyboard.   Especially usefull back in the day when plugging in a keyboard would crash DOS/Windows.


    I've been using DOS since 3.3 and I've never seen it crash from plugging in a keyboard.

    Regardless, the error is pretty annoying when rebooting a machine located deep in the labyrinths of a data center.  I know people who think there's no such place as the maze of twisty passages all alike.  I know they are wrong.

  • Incen (unregistered) in reply to barfo

    Anonymous:

    sub generate_alert( msg) {
      send_alert_email( recipient, msg); # notify someone of problem
      write_alert_to_database( msg); # keep a record for posterity
    }
    event_loop (every 5 minutes) {
      if (database.checkFreeSpace < minimumFreeSpaceThreshold) {
        generate_alert( "Alert: free space is below minimum")
      }
    # ... [deletia] ...
    }

    My email box does that. Imagine my joy when I found out.

    CAPTCHA green on green.

  • Salizar (unregistered)

    This appears to be PHP, although it may look bad, PHP limits the execution time of any processed scripts.
    The default timeout value is 30 seconds. Although it would appear to hang for the user it would in no way take the server down.

    Also the executeQuery call in the WriteErrorToLog is an over loaded version of the one shown above, indicating that there would be another executeQuery, that may or may not call the writeErrorToLog.

    The real WTF is that this was even submitted and posted on the main page...


  • (cs) in reply to ParkinT
    ParkinT:

    Infinite Recursion n. see loop

     
    Loop n. see Infinite Recursion


    Is there another word for "Thesaurus"?


    The scariest WTF here is that people are equating infinite recursion with infinite loops. Recursion tends to be bad for memory, while an infinite loop can run on for years minding its own business.

    If this WTF had been coded by someone who knew the difference between loops and recursion, it would have filled up the file system, which at least would have resulted in a clear exception.

Leave a comment on “The Never Ending Error ”

Log In or post as a guest

Replying to comment #:

« Return to Article