Profile picture
George Porter @georgemporter
, 9 tweets, 2 min read Read on Twitter
A quick story about the hardest bug I ever debugged. My first job in high school was working at a Houston-based ISP called NeoSoft. I was writing a multi-platform web server in Tcl/Tk (w/ OTcl) called NeoWebScript 1/
I noticed that the server was crashing, and the stack trace was really unhelpful (an exception but no actual error or error message). After debugging for several hours, I showed it to my coworkers and it magically started working! Hurray! But wait... 2/
After a few productive hours of working on the server, I went home. The next morning, the same thing happened all over again--a hard crash, a vague exception, and no stack trace. After debugging for a couple hours, it just started working again. ARGH. 3/
My coworkers were perplexed. It worked fine for them, but not for me. But it did work for me when I showed them the code. They had me add a bunch of print statements and assertions. Everything looked good, until the next morning, when it blew up again 4/
On day three I found the problem. See, in Tcl/Tk, everything is a "string" and types are inferred at runtime by looking at the contents of the string. I had a variable that held the time, I think to implement the If-modified-since header. 5/
See, I got to work at 8am. My coworkers came into work at noon. 6/
In Tcl/Tk, a string that starts with "08" or "09" (the hours I was working alone before they came in) were incorrectly interpreted as octal numbers. And 08 and 09 are not valid octal numbers. 7/
Of course, when they came in, the variable held "12" or "01" or "02", and so everything worked fine. Yes, this program worked 22 hours a day, and crashed between 8:00am and 9:59am. *head banging on desk* 8/
I'm a huge fan of static types now! Also, the reason this error didn't surface to me was that someone had wrapped the entire web server in a giant "try... except (Exception e) { }" block that caught every exception and just quietly threw it away. Yeah please don't do that. 9/9
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to George Porter
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member and get exclusive features!

Premium member ($3.00/month or $30.00/year)

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!