I just spent 16 hours debugging a complicated, annoying and frustrating problem involving pages not loading in a database frontend, and being spontaneously logged out of a webmail application.
The culprit was the SQLite library (or its bindings to Ruby) being useless with error messages. An example:
#<SQLite3::CantOpenException: could not open database: unable to open database file>
This is not okay. First off, not saying what file is a little annoying, but thankfully, I can tell which file by context since this program only opens one database. Second, and most grievous, it doesn't say which system call failed (though I guess it's open(2))
errno.h exists, people! perror is your friend. A happy little "It didn't work" exception is no replacement for an exception that could read like this: #<SQLite3::CantOpenException: could not open database important.db: EMFILE: The process already has the maximum number of files open.></p>
I wouldn't be hacking about supposing it's a concurrency and locking issue. I'd be knowing that something's not closing files like it's supposed to, like I now know after stracing the process and seeing the real value of errno(3).
Don't do this, folks! Let exceptions carry the most information possible. If you code in C, use perror(3).
Now I get to see why my web framework isn't closing the database on a reload.
August 29 2008, 20:01:46 UTC 3 years ago
whoa.
i think you just broke my brain.
August 29 2008, 20:02:22 UTC 3 years ago
I get so grumpy with avoidable bugs in software.
August 29 2008, 20:08:00 UTC 3 years ago
my job actually involves a lot of programming-esque things, i just don't have to deal with code at all because i'm designing user interfaces. but it's all about making stuff efficient and intuitive.
August 29 2008, 20:08:46 UTC 3 years ago
That's my favorite part of my work. This part is the one that makes me grumpy.
August 29 2008, 20:16:56 UTC 3 years ago
I'm an information architect. you might be the only person on my friendslist who would have any idea what that means.
August 29 2008, 20:17:32 UTC 3 years ago
More people need to learn to do it well. It'd make my life a lot easier.
August 29 2008, 21:09:20 UTC 3 years ago
i'm hoping to gain a better understanding of programming along the way.
August 30 2008, 01:59:43 UTC 3 years ago
I had to Wikipedia it to make sure I was right, but I was still right. :D
August 30 2008, 02:01:32 UTC 3 years ago
*loves you*
August 30 2008, 02:02:43 UTC 3 years ago
I have no idea what I just promised not to do, but I'm sure it will be quite easy for me to keep this promise nonetheless. ;-)
Anonymous
August 30 2008, 19:31:50 UTC 3 years ago
"The perfect error message"
Back in 2006 I had the same experience, so I wrote this:http://blog.netherlabs.nl/articles/2006/0
Bert Hubert
August 30 2008, 20:00:24 UTC 3 years ago
September 1 2008, 12:44:09 UTC 3 years ago
September 3 2008, 12:34:53 UTC 3 years ago