3
AceDev
238d

Any tips on what to do after 2 days of trying to fix a bug in a published project cos I'm losing my mind right now??

Comments
  • 10
    Stop trying, and just fix it.

    Seriously though - methodically go through everything you can and isolate it as much as possible. Don't just guess at fixes. Write failing tests, then try to get them all passing.

    If you're really stumped, then your options at that point are finding a like minded dev who can also have a go or help you out.
  • 3
    Going for a walk helps. Sometimes, all you need is to detach yourself from the issue and come back to it later. :)

    Also second the comment by @almondsauce.
  • 3
    bisect? It works both over space (code location) and time (commits)
  • 0
    In practice most projects don't lend themselves to interrogation sadly, so bisection is among the most tedious and annoying debugging techniques, but by design it hardly ever fails.
  • 1
    although quite recently I had the misfortune of having to debug an issue the emergence of which depended on the iteration order of hashmaps, so subtlw changes caused by print calls would change the symptoms. If you have a debugger, this can usually be avoided.
  • 0
    @lorentz Bisect is fantastic for regressions, so long as your commit history is sensible. For bugs that have "always been there" though or with a convoluted git history - not so much.
  • 1
    @AlmondSauce `git bisect` is great if Git provides a roughly even sequence of changes. Bisection as a debugging technique however works along any breakdown of the code that is roughly even, although it does take longer. If you can formalize something that should not be happening but it is, then for any slicing of the code at least one part will be causing the problem. It's not really a grand idea if you generalize it this much, but it still works.
  • 1
    @AlmondSauce “write failing tests and get them to pass” is probably the best advice.

    + log whatever you can around whatever you could isolate

    If you cannot reproduce issues in dev, isolate what’s different vs prod and test those manually (postman/curl)

    Put down the flow in a chart and mark things green/red about which part works and which doesn’t. That’ll help isolate things for bigger flow where data moves between 15 systems to generate results.
  • 1
    @AlmondSauce I think I'm gonna try this... write failing tests
  • 1
  • 1
    Feed whole codebase to one of GPT thingies;)

    Alternatively, if being reasonable, I'd write tests and isolate stuff
  • 1
    @Been-Outside If you are using "GPT thingies", use the Cursor IDE. First 50 calls to GPT-4 are free, and it is really cool (when it works).
  • 1
    @nanobot I am using those, but for minor things which I'm not sure how to start googling or would need to look up multiple sources. E.g. most recent one was about Excel macros. Never worked with those, will never work in future, so gpt is just simpler.

    Or recipies. More often than not, those are great
Add Comment