telophase: (FMA - Ed panicking)
telophase ([personal profile] telophase) wrote2006-04-21 02:41 pm
Entry tags:

Twilight Zone

Does anyone else here who programs have the weird experience of a script suddenly throwing an error for the first time, and when you go to look at it, the line that throws the error is unarguably wrong, no doubt about it, such that you find yourself nodding in agreement about the error...

...and then you realize that even with that error, it worked for the past five months. The question isn't "Why did this stop working?" but "Why did this ever work at all?"

This happens to me all the fucking time.


(And I have independent confirmation that I didn't just miss testing that bit - this is from that survey script I wrote back in November, and the report that used this script to produce its results has already been written.)

[identity profile] selenite.livejournal.com 2006-04-21 09:12 pm (UTC)(link)
You've found a schroedinbug.
http://www.catb.org/jargon/html/S/schroedinbug.html

[identity profile] telophase.livejournal.com 2006-04-21 09:18 pm (UTC)(link)
Ooh, even named. :)

It was a simple bug and a simple fix, too - the results on some questions were text fields, not INT fields, and the SQL query was looking for results based on the = operator. Once I told it to stop doing that on those questions, it went back to working, happy as a clam. There's just no reason it should have worked in the first place. My coworker, who doesn't program (she does the hardware and updates and stuff in the library) was wondering if it had to do with the patches that recently got rolled out, but I can't see where that would have anything to do with, basically, sending a buggy SQL query. *worries on it some more*

[identity profile] tprjones.livejournal.com 2006-04-22 12:00 am (UTC)(link)
Hmmmm ... that is a bit odd. Your coworker has suggested the only thing I could think of, that some particular version of the ware you were using included a bit of error workaround that would convert as needed, but why that funcionality if it existed would be removed in a revision is beyond me.

Any looping or branching in the prog? So, any chance that particular piece of code was just never triggered until now?

[identity profile] telophase.livejournal.com 2006-04-22 12:21 am (UTC)(link)
I'm using SQL Server, and I don't know if they updated it recently, but I can't think of any reason for it to have worked previously.

The basic script is one that pulls the results of the fall survey from the database of answers. 20 of the questions have two fields each: an INT field that has the values of 0-4 based on their satisfaction level, and a TEXT field for comments. The last four only have TEXT fields, because they're open-ended questions like "What can we improve about the library?"

I pull the records out based on various criteria (i.e. you can ask for all the graduate students and undergraduates in the School of Business who are Satisfied with the library's website) and build a table of the statistics - 35% of undergraduates said they liked it, etc. Before the fix, the query was asking, no matter what question you picked, for all the records where the answer field fit the satisfaction measure. So of course, due to not-the-best database design on my part*, if you asked for one of the four questions without the satisfaction level, it checked to see if the answer field met the 0-4 criteria. Which didn't work, it being text. I threw in an if statement saying that if the question they wanted the answer for was one of the last four, then skip that bit.

Can't post the code since I'm home and not at work. You'll have to deal with my description. :D

The only people who have the permissions and the knowhow to change the code are my boss and me, and he wouldn't have made that sort of error, and he would have told me that he'd edited it anyway - he's very good at leaving tracks so as not to mess anyone else up.


* If I have time for next year's survey, I'll rebuild the database design and the script based on what I've learned this year. If I don't have time, well, it works well enough. The code probably sucks anyway and could do with a really good scrubbing.

[identity profile] telophase.livejournal.com 2006-04-22 12:23 am (UTC)(link)
* And it did work before, because we used the script to create the survey report. I've used it, the survey subcommittee head used it, and the librarian who reported it had used it before, as well as those of us who were assigned to summarize those four questions.

ARG.

[identity profile] selenite.livejournal.com 2006-04-22 04:36 am (UTC)(link)
It's magic. Somebody is depleting the level of mana at TCU, so programs have to run how they were written instead of just intended. Once it recharges to the usual level the bugs will disappear again.

(I pull this explanation out whenever I figure that more searching for the real cause would be bad for my blood pressure)