- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
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.
Admin
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.
Admin
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>]
Admin
Simply put: This is why global variable scope is evil.
Admin
diskpart.exe
sel dis 0
sel par 0
inactive
exit
shutdown.exe -r -t 1
that will fix everything....
- SPT
Admin
The real WTF is how a bunch of IT professionals can never agree on what the real WTF is, EVER!
Admin
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
Admin
<FONT color="#ffa500" size=6>"Concentrated WTF. Now with Calcium!"</FONT>
[:P]
Admin
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
Admin
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] ...
}
Admin
<FONT face=Georgia color="#a52a2a" size=6>Cool sig. Sir Mix-A-Lot, no?</FONT>
[8-)]
Admin
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
Admin
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.
Admin
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.
Admin
I am going to have to respectfully, but vehemently, disagree.
Admin
Doh. This is the first DWTF that I've actually done before.
:$
Admin
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:
Admin
Indeed, but I have to admit that I stole it from someone else.
Admin
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.
Admin
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 [email protected].
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!
Admin
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.
Admin
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.
Admin
Why yell at him? He agrees with you.
Admin
"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.
Admin
<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-)]
Admin
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.
Admin
Not really. Look closer:
The same is done around the $description and $script portions.
Admin
Ack! Again, without markup..
"INSERT INTO errorLog (ownerID,time,description,script) VALUES ( ' " . $owner . " ' ,Now(),'" . $description . "','" . $script . "')";
Admin
The real WTF is some people in the forum calling the infinite RECURSION, an infinite loop ...
Admin
Technically, you are right. So what?
Admin
For instance, women with small mouths.
Admin
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....
Admin
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.
Admin
Is'nt the WTF the use of PHP?
/H
Admin
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.
Admin
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.
Admin
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.)
Admin
Not always. See http://en.wikipedia.org/wiki/Tail_recursion, though this is not such a case.
Admin
Nope. Perl uses 'sub', not 'function'.
Admin
Made me laugh, after the penny dropped.
Admin
Thank you.
But that is not ONE word.[+o(]
Admin
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.
Admin
I don't know, but do you know what 'dictionary' means and where I can find out ?
Admin
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...
Admin
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,
Admin
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.
Admin
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.
Admin
My email box does that. Imagine my joy when I found out.
CAPTCHA green on green.
Admin
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...
Admin
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.