DEV Community

Ben Halpern
Ben Halpern

Posted on

Tell me a bug story

Bugs are inevitable; Debugging is painful, but the experiences make us better developers.

So let's hear it! Tell us about some of the bugs you've encountered, and how you dealt with it.

Latest comments (53)

Collapse
 
tchaflich profile image
Thomas C. Haflich

This one was a bug with a third party vendor. I found the bug for them, and it probably remains unfixed to this day.

We were sending off sheets to be printed, and these sheets included randomly generated unique passcodes of five alphanumeric digits (that is, matching /^[a-z0-9]{5}$/). We had users log into a portal with these passcodes, along with other authentication information. For years, this was the case without issue.

Then one day, I get a support call...

CALLER: Hi, I can't log onto the portal. It says it can't find me?
ME: Hold on one second, let me look you up.
  [I get the CALLER's information and search for them in the database.]
ME: Okay. It looks like your information is all correct on my end. 
ME: Are you seeing any error messages on the screen?
  [We go through the standard debugging steps. You know the drill.]
ME: Can you read me the code on your printout?
CALLER: One, two, three, zero, zero, zero, zero, zero...
ME: Sorry, the five digit code on your printout. 
ME: It should be under the heading "Passcode," in green.
CALLER: Yeah, that's it.
CALLER: It looks weird like it's going over the box or something though.

At this point, I have a suspicion. I look up the details in the database again.

+---------+--------+----------------+----------+
| fake_id |   name | account_number | passcode |
+---------+--------+----------------+----------+
|    9001 | CALLER | ASDF1234FOOBAR |    123E4 |
+---------+--------+----------------+----------+

Some of you may have spotted the issue already. For those who haven't, let's zoom in.

The passcode is listed in our database as 123E4.

ME: I'm very sorry, but can I call you back?

I had to confirm that we sent the passcode out as plain text to the vendor - we in fact did. Whatever process they used to lay out the prints had somehow interpreted our string as exponential notation all on its own.

We couldn't convince them that it was their issue, or tell them how to fix it, so our solution was...

To stop including the letter "e" in our codes Β―\_(ツ)_/Β―

Collapse
 
berniwittmann profile image
Bernhard Wittmann

This is probably the best bug story I ever heard (Of course not mine)

The E-Mail that could not be sent farther than 500 miles

Collapse
 
lepinekong profile image
lepinekong • Edited

In a big corp, on a java financial application for about 2000 internal users, there was a huge bug that regularly lost datas, each month I had to play sherlock holmes to reconstitute all history of update from log with a giant sql to put datas back so as to feed the accounting app. The other department who developped it couldn't find why, for them it was due to the fact it was a big application so from time to time it was overwhelmed and so lost data. Improbable explanation, but politically you cannot argue in a big corp... I wait for a huge change in IT system to have more favorable political context to oblige to fix the problem after 2 years. Finally the cause was found: someone made a copy and paste of a value, when a user follows some path they didn't expect, that bad code was executed and caused data to be dropped. Overall, the cost of such bug just discounting a few days I had to lose each month on it was about 100K Euros for a bad copy and paste by a developer :)

Collapse
 
garfbradaz profile image
Gareth Bradley • Edited

Once there was a very hungry Caterpillar.....πŸ›

Collapse
 
stevezieglerva profile image
Steve Ziegler

I was managing a really small team (me, 1 dev, 1 tester) and we built a node on our government client's data exchange platform. We traveled to their office for acceptance testing. Everything ran fine locally but only worked the first time when deployed on the server. It drove us crazy and we wasted weeks onsite trying to fix it. I was convinced there was an issue with the other vendor's platform. Finally in frustration, I started reviewing all of the developer's code and saw a variable declared as static. You rarely see those in the wild and questioned him on it. He just thought it might be a good idea to use a static there. It was completely unnecessary and the reason for our run-once issue. He removed it, recompiled and deployed. It worked the 2nd time, and the 3rd, and the 4th ...

Happy Coding!

Collapse
 
lexlohr profile image
Alex Lohr

I once wrote a limited JS parser to remove comments and stitch different JS files together into one bundle in PHP (that was before grunt, gulp and webpack or even node.js or AST-based JS transpilers. Yes, I'm that old). Somehow, it broke the code of one of our applications and I had a hard time figuring out where this happened.

First, I made sure that nothing but comments had been removed, but everything was correct on this account. Then, I had a closer look at the bug.

TypeError: undefined is not a function

So I searched the whole code for calls of variables that could in some circumstances not contain a function. Again, without any result. After long hours of searching fruitlessly, I had a coffee and try to look at the problem from a new perspective and suddenly, like clouds indiscernibly shifting forms, I saw the issue.

In two of the files, we had encapsulated our code in an IEFE (immediately executed function expression) not to leak variables into the global scope and forgot a semicolon after the first one. The resulting code went like that:

(function() { ... })()
(function() { ... })();

Do you see it, too? The opening parentheses of the second IEFE were interpreted as a call of the assumed function returned by the first IEFE (which of course returned undefined). I introduced a small filter into my parser that made sure that any IEFE would be terminated with a semicolon so that this error should never ever happen again.

Collapse
 
prsanjay profile image
Sanjay Prajapati

I was working on the issue occurred while loading the General Settings Page in E-commerce store built with Spree 3.7 + Rails 5.2.3 + Ruby 2.6

When I was trying to open the General Settings Page it never opens and browser shows its loading. I checked the back-end log and found that it throws the error: FrozenError - can't modify frozen fatal and nothing else.

After googling the error I found that this FrozenError class has been introduced since Ruby 2.5.0. And it swallows the actually errors.

To debug more precisely I have downgraded ruby to 2.4.6 and after this I found that the issue is with wicked_pdf gem. There is a render method redefined in it and it goes into infinite loop. Which means the render method conflicts with other gems. Here is the details : github.com/mileszs/wicked_pdf/pull...

To resolve the issue, I have downgraded the wicked_pdf version to tag 1.1.0 from latest one.

Collapse
 
jackharner profile image
Jack Harner πŸš€

Here's a dumb one I just encountered:

Spent WAAAYYY too long wondering why palette_desc wasn't getting set properly.

Collapse
 
bradtaniguchi profile image
Brad • Edited

I had one bug I'll never forget that I experienced after only a few months into my first dev job. It taught me a few very important lesson.

I was writing some AngularJs code a few years ago. I found myself having issues with some errors being introduced in a line of code I added. AngularJs uses the ng-model directive to get/set the value from an input to a value in the controller, but the error kept complaining about the directive not existing.
Now matter what I did, the error didn't go away.

  • I assumed it was my dev-server caching. It wasn't.
  • I assumed it was some browser caching. It wasn't.
  • I assumed it was my editor caching something. It wasn't.
  • I assumed my laptop was getting hacked. It wasn't.
  • I assumed even ng-model was defective in the current situation, or broken. It wasn't.

By this time I had spent half the day on the issue, and was getting pretty frustrated. I eventually started writing a Stack Overflow post with my code. I assumed I met some edge-case only a highly experienced developer would know, or it was a bug with the framework and I hit the jackpot.

While writing my post I miss-typed the word ng-model as ng-modal. A massive tidal wave of inspiration hit. I struggled to contain myself as I searched for the original code and sure enough I found the ng-modal directive instead of ng-model

I nearly cried as my single letter code change finally fixed the problem.

I realized I needed to use some better tooling, as it would of saved me an entire day of work. I also realized I should of asked for help sooner as just reviewing the problem provided me solution. Finally, I realized its better to understand the issue than it is to fix it. I spent half the day trying to fix the issue instead of carefully reading the error provided which stated very clearly: ng-modal instead of ng-model.

Happy bug busting!

Collapse
 
stealthmusic profile image
Jan Wedel

I’ve already posted my debugging some time. It about how we were trying to find a reason why some customer passwords did not work.
Enjoy 😊

Collapse
 
razgandeanu profile image
Klaus

Worked at the R&D department of a huge retailer.
Someone pushed a small change and the invoices started having 0 instead of the price.
Talking about production, not some dev environment.

Collapse
 
mvoloskov profile image
Miloslav πŸ³οΈβ€πŸŒˆ πŸ¦‹ Voloskov

I used to work work with CoudhDB. I got a strange error, something like ENOENT 0x938ad373ef BROKEN PIPE so I contacted @wohali (the coolest CouchDB expert on github) and she told me that this nonsense means "Out of disk space" in Erlang. Ouch.

Collapse
 
starchturrets profile image
starchturrets

Twice I've spent hours trying to debug service workers on my Android tablet (which was frustrating because they seemed to work fine on desktop). Both times it was because I messed up the pathway to the files for caching.

Collapse
 
kayis profile image
K

Had one in a 10000 LoC PHP file.

One big class everything interconnected, xdebug blew up when I started it.

Took me around two weeks to find and one line of code to fix.

Good times.

Collapse
 
garrettgreen profile image
Garrett Green

On a small island with a large tree, a colony of ants is preparing food for the arrival of a band of grasshoppers. Of the ants that are working, one of them that stands out is an industrious one named Flik. Flik is constantly inventing new things for the colony to reduce labor, but his ideas are often shouted down and shunned by the colony, who feel the old-fashioned way of preparing the grasshoppers' "offering" is the only way to do things. The only one who seems to believe in Flik is the young Princess of the colony named Dot. Secretly, Flik is attracted to her older sister, Atta, who is next in line for the throne.

As the time for the grasshoppers to arrive approach, the colony heads down into the anthill, intent to wait for the grasshoppers to eat the offering, and leave. Unfortunately, Flik is the last one to put his items on the offering stone, and ends up causing the platform to collapse with his piece of machinery. All the food they've gathered spills into the stream.

When the grasshoppers finally arrive and find nothing, they break into the anthill to terrorize the ants. The leader of the grasshoppers, Hopper, demands that the offering be replenished by the Fall season, and terrorizes Dot, before Flik comes forward to try and defend her. Hopper then commands that the offering be doubled, due to Flik's speaking up against them. During the meeting, Hopper's dimwitted brother, Molt, lets it slip that Hopper is afraid of birds. Hopper silences his brother and the grasshoppers leave, promising to return when the last leaf of Autumn falls.

The colony is now in trouble, as there isn't enough food to fulfill Hopper's request and provide sustenance for the colony. Flik is brought before a tribunal in regards to his causing the trouble. As the group convenes, Flik then thinks up a new idea: if the colony could find bigger bugs to help them defend the colony, they could be instrumental in scaring off the grasshoppers from ever returning. The others think this is a bad idea, until Flik volunteers to look. Thinking that his search will take a long time, the council decides to accept Flik's request, figuring he'll be away from them long enough to keep from causing further trouble.

In another part of the region, a motley crew of bugs are performing in a circus led by a flea, PT Flea. The circus isn't well-attended, most of the audience being flies who jeer and cajole the performers, especially when their acts fail. PT, desperate to keep the flies from leaving, announces a new act call "Flaming Death" where his crew will work together to keep him from being burned. The act fails miserable because the bugs can't coordinate their efforts and PT is burned anyway. He fires them all on the spot.

Flik sets off the next day to head for the big city, eventually finding his way into a 'bug bar,' asking around for tough 'warrior bugs.' His attention is suddenly drawn to a group of bugs in a corner, who it seems are preparing to take on a small gang of flies and their huge member, Thud. They make a valiant effort, posing as medieval knights but their ruse fails and the 'bug bar' ends up being wrecked, and Flik misses much of the fight. However, in the aftermath, Flik thinks he's found the perfect guardians to help his colony.

He pleads his case to the group, saying how he's been looking for bugs with their talent, and asking for their help regarding the incoming group of grasshoppers. The group eagerly accepts, thinking Flik wants them to perform at a dinner theatre and, hoping to avoid trouble from the bar's owner & the flies they fought with, they head off for Ant Island.

When Flik returns, Atta and the elders are shocked that Flik actually found 'warrior bugs.' Atta is at first unsure, but the ladybug of the group. Francis (Dennis Leary), promises that they will knock the grasshoppers 'dead' when they come.

A party is then held in honor of the group, including a tribute and art showing the warriors fighting off the grasshoppers. The group then grows leery, realizing they're meant to fight a war for the ants instead of merely performing. Rosie whispers to Flik that they're actually just circus bugs and Flik is horrified, accusing the group of tricking them. When Atta appears, Flik convinces her that the circus bugs will fight for them.

Discovering their mutual misunderstanding, the circus bugs attempt to leave, but are forced back by a bird. They work together to save Princess Dot, the Queen's daughter and Atta's sister, from the bird as they flee, gaining the ants' trust in the process. They continue the ruse of being "warriors" so the troupe can continue to enjoy the attention and hospitality of the ants. The bird encounter inspires Flik into creating an artificial bird to scare away Hopper, leader of the grasshoppers. The bird is constructed from sticks and leaves, but the circus bugs are exposed by their former ringmaster, P.T. Flea, when he arrives searching for them. Angered at Flik's deception, the ants exile him and desperately try to pull together enough food for a new offering to the grasshoppers, but fail to do so.

When the grasshoppers discover a meager offering upon their arrival, they take control of the entire colony and begin eating the ants' winter store of food. After overhearing Hopper's plan to kill the queen, Dot leaves in search of Flik and the warrior bugs and convinces them to return and save the colony with his original plan. The plan nearly works, but P.T. Flea lights the artificial bird on fire, causing it to crash and be revealed as a fake. Hopper has Flik beaten by his thug, Thumper, in retaliation, but Flik defies Hopper and inspires the entire colony and the warriors to stand up to the grasshoppers and drive them out of the colony.

Before Hopper can be disposed of, it begins to rain where the drops of water are like large bombs. In the chaos, Hopper viciously pursues Flik, who leads him to the actual bird's nest. Hopper mistakes the real bird for another fake bird, and taunts it, attracting its attention. The grasshopper is eaten by the bird and its chicks.

Some time later, Flik has been welcomed back to the colony, and he and Atta are now a couple. As the troupe departs with the last grasshopper, Molt, as an employee, Atta is crowned the new Queen, while Dot gets the princess' crown. The circus troupe then departs as Flik, Atta and Dot watch and wave farewell in a tree branch.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.