3 ms·
We had learned helplessness on a drag and drop bug in jquery UI. I had like three hours every second or third Friday and would just step through the code trying
by hinkley 2y ago
We had learned helplessness on a drag and drop bug in jquery UI. I had like three hours every second or third Friday and would just step through the code trying to find the bug. That code was so sketchy the jquery team was trying to rewrite it from scratch one component at a time, and wouldn’t entertain any bug discussions on the old code even though they were a year behind already.
After almost six months, I finally found a spot where I could monkey patch a function to wrap it with a short circuit if the coordinates were out of bounds. Not only fixed the bug but made drag and drop several times faster. Couldn’t share this with the world because they weren’t accepting PRs against the old widgets.
I’ve worked harder on bug fixes, but I think that’s the longest I’ve worked on one.
- giancarlostoro 2y agoOne of my favorite most elusive bugs was a one liner change. I didn't understand the problem because nobody could reproduce it, or show it. Months later, after my boss told his boss it was fixed, despite never being able to test that it was fixed, I figured it out and fixed it. We had a gift card form, and we stored it in localStorage, if for any reason the person left the tab, and came back months later, it would show the old gift card with its old dated balance, it was a client-side bug. The fix was to use sessionStorage.
- contingencies 2y agoIt seems in the context of your story the old adage that organizations reproduce software in their own architecture again rings true, with multilayered bureaucracy, lies and promises resulting in "client state".
- giancarlostoro 2y agoWhen I tried to explain to him that I fixed the thing he claimed to have fixed, I heard him hesitantly say it wasn't the same bug. Not sure what he told his boss this time around the fix was for, but I was able to fully reproduce the bug with this fix. If you can't reproduce a bug, you cannot in my opinion say that it is fixed. If you have to reproduce it via local debugging and changing a value, or hard coding a value, I think you're possibly close, but there's a chance it might not be the case!
- hinkley 2y agoThe thing with saying “I don’t know” is if you use it judiciously, people believe you more when you say you can do something they think can’t be done. If he didn’t know he would just say. But he says he does.
- giancarlostoro 2y agoHe just did not want to keep his boss waiting longer than a week without a "solution" so he forced something to wash his hands of it.
- arghwhat 2y agoFor web, my favorite is JIT miscompilations. A tie between a mobile Safari bug that caused basic math operations to return 0 regardless of input values (basic, positive Numbers, no shenanigans), or a mobile Samsung browser bug where concatenating a specific single-character string with another single-character string would yield a Number. Debugging errors in JS crypto and compression implementations that only occur at random, after at least some ten thousand iterations, on a mobile browser back when those were awful, and only if the debugger is closed/detached as opening it disabled the JIT was not fun. It taught me to go into debugging with no assumptions about what can and cannot be to blame, which has been very useful later in even trickier scenarios.
- giancarlostoro 2y agoThere's a weird one I ran into, and I for the life of me do not remember which project it was under, but if I open dev tools, the style changes for an element, then if I close dev tools, the style goes back to normal. I never could figure out what the heck is going on. I almost want to blame the viewport size changing just slightly, but I couldn't find a single CSS rule that would make it make sense, and I think even popping it out, it behaved exactly the same. It was frustrating, but I felt like I had to ignore it since no normal user would ever see it, it just made debugging with dev tools confusing. Edit: In your case, that's where I start print debugging LOL
- hinkley 2y agoprintln(“1”); … println(“2”); … println(“wtf”);
- bch 2y agoThis reminds me of finding out (the Hard Way) that Perl’s sort used internally[0] the same $a or $b that I happened to be using. [0] https://perldoc.perl.org/functions/sort https://perldoc.perl.org/functions/sort If the subroutine's prototype is ($$), the elements to be compared are passed by reference in @_, as for a normal subroutine. This is slower than unprototyped subroutines, where the elements to be compared are passed into the subroutine as the package global variables $a and $b (see example below).
- WalterBright 2y agoMy longest one was an uninitialized declaration of a local variable, which acquired ever-changing values. This is why D, by default, initializes all variables. Note that the optimizer removes dead assignments, so this is runtime cost-free. D's implementation of C, ImportC, also default initializes all locals. Why let that stupid C bug continue? Another that repeatedly bit me was adding a field, and neglecting to add initialization of it to all the constructors. This is why D guarantees that all fields are initialized.
- hinkley 2y agoThe first bug I remember writing was making native calls in Java to process data. I didn’t understand why in the examples they kept rerunning the handle dereference in every loop. If native code calls back into Java, and the GC kicks in, all the objects the native code can see can be compacted and moved. So my implementation worked fine for all of the smaller test fixtures, and blew up half the time with the largest. Because I skipped a line to make it “go faster”. I finally realized I was seeing raw Java objects in the middle of my “array” and changing the value of final fields into illegal pairings which blew everything the fuck up.
- ckocagil 2y agoValgrind didn't catch it?
- lttlrck 2y agoMay have been impractical to run valgrind eg embedded. A decent compiler should catch this anyway? -Wall?
- WalterBright 2y agoTesting all code paths means all code paths must be available to the compiler. This is not always practical.
- WalterBright 2y agoIt was before valgrind. Besides, valgrind isn't always available, it requires all code paths to be tested, and it can be really slow making it impractical for some code. Default initialization, on the other hand, gives 100% coverage. Experience with it in D is a satisfying success.