- 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
It's always good to start my week with a CodeSOD, it makes me feel so much better about my own code. Hopefully I know what I don't know.
Admin
Makes me think of the VB6 legacy app we have living around here somewhere. It's a big mess, would make a good entry on this site... But really, reading this makes me glad we stopped maintenance for that... thing...
Admin
Mmm, infinite recursion.
I suppose I should be glad we don't get any of that here, even though it's only because someone was fond of monolithic methods that did everything.
Admin
The code was merely imitating its creator.
Admin
Oh that's awesome! I'd love to see that baby go when disk's full or whatever other error (that will be repeated, which is basically any error) in that function occurs.
Admin
At least they didn't use 'On Error Resume Next'.
Admin
Mmm, race conditions. The schizophrenic class of bug, because it seems like your program has multiple personalities, all trying to write to the log at the same time.
Admin
But you don't understand. It is company policy that all errors are logged!
Hey at least they got the date elements in the right order*:
Oops, never mind:
P.S. TDWTF is WTF'd again today...
Admin
I love the smell of infinite recursion in the morning. It smells like...failure.
Admin
The site looks great today.. ads sometime missing for gray patches, the whole works.. mostly the banner section is haywire.
Admin
I like the "goto EndSub" instead of "exit sub".
I want to blame the infinite loop on someone who was copying and pasting that code into everything without paying attention. Given their brillant commenting though, I somehow doubt this.
Admin
Don't forget, the logs for December 5th will be found in the January 25th file.
Admin
Oh, no! The error logger experienced an error! I'd better report this to the error logger.
Admin
I've only worked with VB6 on a handful of occasions, so I had no clue what was wrong with that code.
Up until the point when it recursed on itself, that is.
Admin
This is Brillant! If we can't write the log entry then try to write that error to the log!
Admin
These people need to get with the 21st century. They should do all logging on Twitter.
Admin
Here is the painting of a landscape. But the artist who painted that picture says "something is missing; what is it? It is I myself who was a part of the landscape I painted". So he mentally takes a step backward, or 'regresses', and paints a picture of the artist painting a picture of the landscape. And still something is missing. That something is still his real self painting the second picture. So he 'regresses' further and paints a third, a picture of the artist painting a picture of the artist painting a picture of the landscape. And because something is still missing, he paints a fourth and fifth picture... so, infinite regression is the moment when our artist, having regressed to the point of infinity, himself becomes a part of the picture he has painted and is both the observer and the observed.
Well, in that peculiar condition, what would he be observing if he were observing time?
He would perceive that time is like a freeway with an infinite number of lanes all leading from the past into the future. But not into the same future. A driver in lane 'A' may crash, while a driver in lane 'B' survives. It follows that a driver, by changing lanes, can change his future.
Do you believe that?
Absolutely. I think it is the only explanation.
Admin
Sure is funny, to log an error when the error logger throws an error. My guess is that the ErrorHandler is a their general routine code they appended to all the functions without checking the function names.
EDIT: Looks like Alex has incorporated this code into his aspx modules: I got this when I tried to submit my comment the first time:
Admin
If only I could figure out what the uncommented lines do...
Admin
Only one problem: VB-everyversion really is that bad.
Admin
I was reading through the code thinking "The comments are a bit odd, and they are being overdescriptive, but other than that it seems okay."
Until I hit the Error Handler routine. As my eyes hit
I made this noise that sounded a bit like "nnnggn" and my left eyelid twitched.
Awesome.
Admin
I swear I have worked on code just like this. Same log file naming error. Same kind of recursion error, although it may have been masked by another level of calls. Not nearly so many comments though, except maybe the odd 8 page block of commented out code.
Admin
All this was made worse by the fact that there was no indication at all as to what had caused the problem in the first place. (It was a combination of a strange front end to lpr that was struggling with printing a large document, and the aforementioned tiny filesystem, but it took quite a bit of work to find that out.)
Admin
No modern programmer needs to live with bad indentation.
There are tools available, and have been available for more than a decade, that change the code to something readable, let you edit it, and then if necessary, change it back to the bad indentation pattern, your changes and all, for minimal source base diffs.
Failure to recognize this just indicates a desire to punish oneself.
Admin
A better explanation is that you're a dumbass.
Admin
I haven't worked with VB6 in a while so I don't remember how it handles things, but I'm not sure that would really be a race condition.
Admin
Just change the color of the comments to a very light gray. You almost won't see them, but they'll be there in case you need clarification on some piece of code. And be thankful you have comments!.
Admin
It's not a vb thing; the race condition happens when more than one thread goes for the logger at the same time just after midnight (or right after starting up on a new day).
Bonus points: what happens in the thread that doesn't create the log file?
Admin
... Or just indicates that you're using the VB6 IDE to work on a VB6 programm ?
Yes I know, VB6 in itself is punishment, but the intro clearly stated how unwillingly they walked that path.
Admin
Admin
Yaaaaay! CodeSOD is back!
Admin
Admin
I found the comments on the left to be surprisingly readable.
Admin
Yeeeeah another RWTF, thanks for a cheerful Monday morning!
Captcha; nulla - The table didn't allow nulla values.
Admin
Admin
Not to rain on your existential thesis, but if all "lanes" from the past into the future exist simultaneously, then does "a driver, by changing lanes" actually change his future? Or just the future that he sees? (i.e.: Limits himself to perception of a single "lane", even though all the other "lanes" (alternate futures) exist.)
Determinism: The reason you "choose" to believe you have free will.
Admin
But how is the auto-indenter supposed to figure out if the comment is related to the line following it or the one preceding it? In this case the empty lines make it kinda obvious to a human, but I doubt this heuristic is built into most pretty printers.. That's why we like slashy //comments on the end of lines and a /* block comment */ preceding a method/subroutine.
Admin
Somehow I think cleaning up the comment indentation is not Matt's top priority here.
Admin
Simple solution for the commentary: make their syntax highlit very close to background color. Easy to focus on actual code.
Admin
What if there are multiple instances of the program on multiple desktops and the app is installed on a network drive?
Admin
Gary Busey?... Is that you?
Admin
Reminds me of the time I decided to use our standard template for our error page, then somehow introduced a NullPointerException into the template. The resulting "Hall of Mirrors" effect reminded me of why I'm not allowed to create Quake 2 levels...
Admin
Admin
In other news, besides obvious infinite recursion, I really liked the comment about Dec. 5, Jan. 25 mixup. Nice catch!
Admin
Hey, at least it's well commented.
Admin
' add 1 to x x = x + 1
I'm sorry, a comment like that ads nothing. It's filler, like soy in a hot dog. It's bloated, fills you up and gives you gas.
The only upside is it makes you look like you're putting in comments.
Admin
Damn dirty apes.
Admin
I wrote a VB6 program a long time ago that whenever an error occured it would show a message saying "[Error message] - full details of this error will be written to the log file".
If writing the log then failed it then displayed the message "Regrettably an error occured writing to the error log - this is just going to be one of those days.".
It was over 6 years before a client reported getting that message :P
Admin
Admin
I've seen my quote of loggers that log logger's errors, but this one composes that with oppening the error file every time it is called, race conditions at that oppening, that make logging errors a sure condition, and bad comments! That is precious!
On a side note, that can't be code of a web application. It must be on single threaded desktop software. It wouldn't live for half an hour at a massively paralel web server.