Hacker News new | past | comments | ask | show | jobs | submit login
A collection of debugging stories (github.com/danluu)
155 points by luu on Aug 23, 2015 | hide | past | favorite | 16 comments



Nice! Sent in a pull request to add mine: http://gyrovague.com/2015/07/29/crashes-only-on-wednesdays/


It happens quite often that bugs end up being obscure things like this.

The a-ha moment when you've figured one out is interesting. It's always a mixture of pleasure at having discovered a complex causal chain and horror at having written it.


A book-length, epic debugging story is in Ellen Ullman's novel The Bug:

http://www.amazon.com/The-Bug-Novel-Ellen-Ullman/dp/12500024...


Another great read for debugging that was recommended to me years ago:

http://www.amazon.com/Debugging-Indispensable-Software-Hardw...


Great collection!

Maybe one could ask the authors if they could donate their debugging articles to a cc licensed repository so the articles themselves could be hosted instead of linking? That would be very nice I think.


"This is the only time in my entire programming life that I've debugged a problem caused by quantum mechanics." [1]

This quote is amazing lol

[1] http://www.gamasutra.com/blogs/DaveBaggett/20131031/203788/M...


Don't want to write a real post but my most memorable simple story was with a C optimizing compiler. I was using a something like struct Item { char name[12]; int flag; } with code that would would use this in a btree and use memcmp(x,y,sizeof(Item)) for ordering. The name could be non-unique but name+flag would be and give specific ordering. To fill Item I used something like (much simplified):

  x = (Item*)malloc(sizeof(Item));
  memset(x->name, 0, 12); 
  strcpy(x->name, name);
  x->flag = flag;
So the bits after name are now significant in compares but expected to be zero because of memset. Well the optimizer would effectively remove the memset in release builds due to the strcpy so the code worked most of the time in release but would occasionally break because the bytes after the null terminated name could be anything and would only come into play when name was the same for 2 items.


For some reason i love reading these kind of stories, especially when you get the feel the writer is venting after a deep dive of the OS guts.

A close equivalent is reading Derek Lowe's "things i won't work with" articles.


I absolutely loved the "Things I won't work with" articles, very enjoyable to read. And I even learned some things about chemistry in the process. I can only recommend everybody who is even slightly interested in chemistry to read them.



seems he has since moved to sciencemag, but i don't see any new articles in that category over there (and all his old corante stuff has been copied over).

http://blogs.sciencemag.org/pipeline/archives/category/thing...


Sorry, but that first one:

http://nanxiao.me/en/an-experience-of-fixing-a-memory-corrup...

is really dumb. The moral is that you don't use global variables that are accessed by multiple threads (unless you're very careful). That's C programming 101.


Great collection! Love these kinds of stories - hate to struggle with these kinds of problems.


No critism, but why would this be different than some of the contributions on the daily wtf?


It's OK to have similar/duplicate things on the Internet. (It often is the case.)


Brought a smile to my face to see my story up there as #2 :)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: