What the hell??!? (blah, blah of a wannabe alien)
The $10,000 Space
If you are a programmer, have you ever had one of those bizarre situations where you know something is not working, but you aren’t getting an error or anything else that would make debugging easy?
A couple days ago I migrated a cluster of web servers to PHP 5.1.x (they were running PHP 4.4.x before). One of the things I run on them is a geo targeting mechanism, and in the case where my screw-up was, a function to block a subnet of IP addresses.
[code=php]echo sprintf("%u", ip2long(' 80.1.2.3'));[/code]
That little bit of code was my fuck up… PHP 4.4.x returns “1342243331” (as expected), but PHP 5.1.x would return “0“. PHP4 was more forgiving of the stray leading space before the IP address, while PHP5 was not. The end result was that every IP address before 81.1.2.3 was blocked, instead of blocking FROM that IP address to an end IP address (that was not very many IPs away).
Awesome… so what happened here? I ended up blocking about 40% of the potential traffic for awhile, which equated out to probably about $10,000 in lost revenue.
The lesson learned? Don’t fuck around with spaces, because they will cost you many hours of debugging/tracing as well as ~$10,000.
| Print article | This entry was posted by Shawn on September 26, 2006 at 10:44 pm, and is filed under Coding. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 5 years ago
damn, I know the feeling… at least it only cost you $10,000 different if it takes a week to solve the error
about 5 years ago
Are you anti-”Trim”?
about 5 years ago
Your face is a space.
about 5 years ago
No, I’m not anti-trim… I just don’t make a point of trimming variables that I set statically.
about 5 years ago
no static at all…. FM.. no staic at all
about 5 years ago
Use Perl… =c)
about 5 years ago
Oh yes..
And you call yourself a coder ??
Damn it feels good to kick someone else for it
about 5 years ago
That’s why you need to have a development server that has the same software (os, php, libraries….) as the production server….
It costs less than 10.000$ and it can take you out of troubles
about 5 years ago
I do have development servers (actually 2 of the 10 blades in the chassis are test/development machines currently). This issue would only surface under high traffic though… I only knew something was wrong because the overall conversions were down (but not gone).
about 5 years ago
You missed 40 visitors or 40 % of visitors?
about 4 years ago
how much do you make from sites shawn ?