Why you shouldn't write code first thing Monday morning
-
Got a server I developed... Really nice design with a message routing system, where each worker module has a name, and the client can send requests to different parts of the system with the same interface... Works like a charm, but it's not that great when you're half-asleep. So this morning, I wrote a new client-side routine to get some basic status information... What version of the server is running, the name of the machine, the operating system name, memory usage, etc. Not exactly rocket science. I already have a worker on the server called "Monitor", so I put the server-side code in there... All I do is send a "STATUS" command, and it sends back a bunch of data fields. Pop open GetExecutingAssembly() for the version, pop open GetCurrentProcess() for a few more fields. Nothing I haven't done a hundred times before. Test it out... Crash... Huh? After a dose of caffeine, I remember how to open the event log, and see it's an ArgumentNullException. I inspect the Monitor job, and the whole thing is inside a Try/Catch, handling ALL exceptions with a nice, clean logging command... How could it possibly crash? I start commenting out one piece at a time, trying to figure out which one kills it. Spent an hour doing this, and it still crashed every single time I sent that "STATUS" command... FINALLY, I woke up, and realized the server is just fine. So what was wrong? I wasn't sending the command to the "Monitor" worker... I had copy-pasted the request code from another module, and was sending it to the "Control" worker, whose job it is to handle upgrades/restarts/shutdowns... And THAT worker happened to be missing an error handler. That's like going into a bank and repeatedly trying to make a deposit, then FINALLY realizing that you're talking to the security guard instead of the teller. :doh:
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
Got a server I developed... Really nice design with a message routing system, where each worker module has a name, and the client can send requests to different parts of the system with the same interface... Works like a charm, but it's not that great when you're half-asleep. So this morning, I wrote a new client-side routine to get some basic status information... What version of the server is running, the name of the machine, the operating system name, memory usage, etc. Not exactly rocket science. I already have a worker on the server called "Monitor", so I put the server-side code in there... All I do is send a "STATUS" command, and it sends back a bunch of data fields. Pop open GetExecutingAssembly() for the version, pop open GetCurrentProcess() for a few more fields. Nothing I haven't done a hundred times before. Test it out... Crash... Huh? After a dose of caffeine, I remember how to open the event log, and see it's an ArgumentNullException. I inspect the Monitor job, and the whole thing is inside a Try/Catch, handling ALL exceptions with a nice, clean logging command... How could it possibly crash? I start commenting out one piece at a time, trying to figure out which one kills it. Spent an hour doing this, and it still crashed every single time I sent that "STATUS" command... FINALLY, I woke up, and realized the server is just fine. So what was wrong? I wasn't sending the command to the "Monitor" worker... I had copy-pasted the request code from another module, and was sending it to the "Control" worker, whose job it is to handle upgrades/restarts/shutdowns... And THAT worker happened to be missing an error handler. That's like going into a bank and repeatedly trying to make a deposit, then FINALLY realizing that you're talking to the security guard instead of the teller. :doh:
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
Got a server I developed... Really nice design with a message routing system, where each worker module has a name, and the client can send requests to different parts of the system with the same interface... Works like a charm, but it's not that great when you're half-asleep. So this morning, I wrote a new client-side routine to get some basic status information... What version of the server is running, the name of the machine, the operating system name, memory usage, etc. Not exactly rocket science. I already have a worker on the server called "Monitor", so I put the server-side code in there... All I do is send a "STATUS" command, and it sends back a bunch of data fields. Pop open GetExecutingAssembly() for the version, pop open GetCurrentProcess() for a few more fields. Nothing I haven't done a hundred times before. Test it out... Crash... Huh? After a dose of caffeine, I remember how to open the event log, and see it's an ArgumentNullException. I inspect the Monitor job, and the whole thing is inside a Try/Catch, handling ALL exceptions with a nice, clean logging command... How could it possibly crash? I start commenting out one piece at a time, trying to figure out which one kills it. Spent an hour doing this, and it still crashed every single time I sent that "STATUS" command... FINALLY, I woke up, and realized the server is just fine. So what was wrong? I wasn't sending the command to the "Monitor" worker... I had copy-pasted the request code from another module, and was sending it to the "Control" worker, whose job it is to handle upgrades/restarts/shutdowns... And THAT worker happened to be missing an error handler. That's like going into a bank and repeatedly trying to make a deposit, then FINALLY realizing that you're talking to the security guard instead of the teller. :doh:
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)That wasn't a cockup. It was "planned testing" which revealed a hither-to unknown bug in the "Control" worker (i.e. that it needs a try...catch block) before any user problem occurred. That's a useful way to spend a Monday - find a serious bug by planned testing, and fix it, all before the user notices...
Did you know: That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
-
Got a server I developed... Really nice design with a message routing system, where each worker module has a name, and the client can send requests to different parts of the system with the same interface... Works like a charm, but it's not that great when you're half-asleep. So this morning, I wrote a new client-side routine to get some basic status information... What version of the server is running, the name of the machine, the operating system name, memory usage, etc. Not exactly rocket science. I already have a worker on the server called "Monitor", so I put the server-side code in there... All I do is send a "STATUS" command, and it sends back a bunch of data fields. Pop open GetExecutingAssembly() for the version, pop open GetCurrentProcess() for a few more fields. Nothing I haven't done a hundred times before. Test it out... Crash... Huh? After a dose of caffeine, I remember how to open the event log, and see it's an ArgumentNullException. I inspect the Monitor job, and the whole thing is inside a Try/Catch, handling ALL exceptions with a nice, clean logging command... How could it possibly crash? I start commenting out one piece at a time, trying to figure out which one kills it. Spent an hour doing this, and it still crashed every single time I sent that "STATUS" command... FINALLY, I woke up, and realized the server is just fine. So what was wrong? I wasn't sending the command to the "Monitor" worker... I had copy-pasted the request code from another module, and was sending it to the "Control" worker, whose job it is to handle upgrades/restarts/shutdowns... And THAT worker happened to be missing an error handler. That's like going into a bank and repeatedly trying to make a deposit, then FINALLY realizing that you're talking to the security guard instead of the teller. :doh:
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
That wasn't a cockup. It was "planned testing" which revealed a hither-to unknown bug in the "Control" worker (i.e. that it needs a try...catch block) before any user problem occurred. That's a useful way to spend a Monday - find a serious bug by planned testing, and fix it, all before the user notices...
Did you know: That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
Good point :) It did inspire me to write a catch-all handler for all workers, so the server will keep running even if I make this mistake again.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
Ian Shlasko wrote:
then FINALLY realizing that you're talking to the security guard instead of the teller
And why are you posting this here on craigslist ? just kidding !
Single white geek with software glitch seeks compatible female with bugfix to-- Uh, I'll stop before my sick mind makes this non-KSS.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
Single white geek with software glitch seeks compatible female with bugfix to-- Uh, I'll stop before my sick mind makes this non-KSS.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)Ian Shlasko wrote:
Single white geek with software glitch seeks compatible female with bugfix to--
-- handle errors in safe work conditions and compile like a pro. (See, it can still be KSS.)
If I have accidentally said something witty, smart, or correct, it is purely by mistake and I apologize for it.
-
Got a server I developed... Really nice design with a message routing system, where each worker module has a name, and the client can send requests to different parts of the system with the same interface... Works like a charm, but it's not that great when you're half-asleep. So this morning, I wrote a new client-side routine to get some basic status information... What version of the server is running, the name of the machine, the operating system name, memory usage, etc. Not exactly rocket science. I already have a worker on the server called "Monitor", so I put the server-side code in there... All I do is send a "STATUS" command, and it sends back a bunch of data fields. Pop open GetExecutingAssembly() for the version, pop open GetCurrentProcess() for a few more fields. Nothing I haven't done a hundred times before. Test it out... Crash... Huh? After a dose of caffeine, I remember how to open the event log, and see it's an ArgumentNullException. I inspect the Monitor job, and the whole thing is inside a Try/Catch, handling ALL exceptions with a nice, clean logging command... How could it possibly crash? I start commenting out one piece at a time, trying to figure out which one kills it. Spent an hour doing this, and it still crashed every single time I sent that "STATUS" command... FINALLY, I woke up, and realized the server is just fine. So what was wrong? I wasn't sending the command to the "Monitor" worker... I had copy-pasted the request code from another module, and was sending it to the "Control" worker, whose job it is to handle upgrades/restarts/shutdowns... And THAT worker happened to be missing an error handler. That's like going into a bank and repeatedly trying to make a deposit, then FINALLY realizing that you're talking to the security guard instead of the teller. :doh:
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)Of course, there are good reasons to code first thing on a Monday morning. This morning, after more than two weeks of effort, I fixed our https/silverlight/wcf connectivity issue. I got here at 6:30, and had it fixed before 8...
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
Got a server I developed... Really nice design with a message routing system, where each worker module has a name, and the client can send requests to different parts of the system with the same interface... Works like a charm, but it's not that great when you're half-asleep. So this morning, I wrote a new client-side routine to get some basic status information... What version of the server is running, the name of the machine, the operating system name, memory usage, etc. Not exactly rocket science. I already have a worker on the server called "Monitor", so I put the server-side code in there... All I do is send a "STATUS" command, and it sends back a bunch of data fields. Pop open GetExecutingAssembly() for the version, pop open GetCurrentProcess() for a few more fields. Nothing I haven't done a hundred times before. Test it out... Crash... Huh? After a dose of caffeine, I remember how to open the event log, and see it's an ArgumentNullException. I inspect the Monitor job, and the whole thing is inside a Try/Catch, handling ALL exceptions with a nice, clean logging command... How could it possibly crash? I start commenting out one piece at a time, trying to figure out which one kills it. Spent an hour doing this, and it still crashed every single time I sent that "STATUS" command... FINALLY, I woke up, and realized the server is just fine. So what was wrong? I wasn't sending the command to the "Monitor" worker... I had copy-pasted the request code from another module, and was sending it to the "Control" worker, whose job it is to handle upgrades/restarts/shutdowns... And THAT worker happened to be missing an error handler. That's like going into a bank and repeatedly trying to make a deposit, then FINALLY realizing that you're talking to the security guard instead of the teller. :doh:
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)Ian Shlasko wrote:
going into a bank and repeatedly trying to make a deposit, then FINALLY realizing that you're talking to the security guard instead of the teller
:thumbsup: :-D I'm so going to spit this out, somewhere, during some conversation, giving the illusion i'm naturally insightfully funny.