• Quacksalber@sh.itjust.works
    link
    fedilink
    arrow-up
    101
    ·
    3 months ago

    Aren’t those almost always race condition bugs? The debugger slows execution, so the bug won’t appear when debugging.

    • BlueKey@fedia.ioOP
      link
      fedilink
      arrow-up
      50
      arrow-down
      1
      ·
      3 months ago

      Turned out that the bug ocurred randomly. The first tries I just had the “luck” that it only happened when the breakpoints were on.
      Fixed it by now btw.

      • Skullgrid@lemmy.world
        link
        fedilink
        arrow-up
        61
        arrow-down
        1
        ·
        3 months ago

        bug ocurred randomly.

        Fixed it by now btw.

        someone’s not sharing the actual root cause.

        • BlueKey@fedia.ioOP
          link
          fedilink
          arrow-up
          38
          ·
          3 months ago

          I’m new to Go and wanted to copy some text-data from a stream into the outputstream of the HTTP response. I was copying the data to and from a []byte with a single Read() and Write() call and expexted everything to be copied as the buffer is always the size of the while data. Turns out Read() sometimes fills the whole buffer and sometimes don’t.
          Now I’m using io.Copy().

          • dfyx@lemmy.helios42.de
            link
            fedilink
            arrow-up
            31
            ·
            3 months ago

            Note that this isn’t specific to Go. Reading from stream-like data, be it TCP connections, files or whatever always comes with the risk that not all data is present in the local buffer yet. The vast majority of read operations returns the number of bytes that could be read and you should call them in a loop. Same of write operations actually, if you’re writing to a stream-like object as the write buffers may be smaller than what you’re trying to write.

            • bl_r@lemmy.dbzer0.com
              link
              fedilink
              arrow-up
              6
              ·
              3 months ago

              I’ve run into the same problem with an API server I wrote in rust. I noticed this bug 5 minutes before a demo and panicked, but fixed it with a 1 second sleep. Eventually, I implemented a more permanent fix by changing the simplistic io calls to ones better designed for streams

            • xthexder@l.sw0.com
              link
              fedilink
              arrow-up
              1
              ·
              3 months ago

              Ah yes… several years ago now I was working on a tool called Toxiproxy that (among other things) could slice up the stream chunks into many random small pieces before forwarding them along. It turned out to be very useful for testing applications for this kind of bug.

      • dunz@feddit.nu
        link
        fedilink
        arrow-up
        9
        ·
        3 months ago

        I had a bug like that today . A system showed 404, but about 50% of the time. Turns out I had two vhosts with the same name, and it hit them roughly evenly 😃

        • vortexsurfer@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          3 months ago

          Had a similar thing at work not long ago.

          A newly deployed version of a component in our system was only partially working, and the failures seemed to be random. It’s a distributed system, so the error could be in many places. After reading the logs for a while I realized that only some messages were coming through (via a message queue) to this component, which made no sense. The old version (on a different server) had been stopped, I had verified it myself days earlier.

          Turns out that the server with the old version had been rebooted in the meantime, therefore the old component had started running again, and was listening to the same message queue! So it was fairly random which one actually received each message in the queue 😂

          Problem solved by stopping the old container again and removing it completely so it wouldn’t start again at the next boot.

      • xthexder@l.sw0.com
        link
        fedilink
        arrow-up
        1
        ·
        3 months ago

        And that’s where Release with debug symbols comes in. Definitely harder to track down what’s going on when it skips 10 lines of code in one step though. Usually my code ends up the other way though, because debug mode has extra assertions to catch things like uninitialized memory or access-after-free (I think specifically MSVC sets memory to 0xcdcdcdcd on free in debug mode).

      • leisesprecher@feddit.org
        link
        fedilink
        arrow-up
        31
        ·
        3 months ago

        One of our customers does that. It happened multiple times already that one dev fixed an issue in production, and the next regular deployment overwrote everything.

        But fortunately, it’s just critical infrastructure and nothing important.

        • henfredemars@infosec.pub
          link
          fedilink
          English
          arrow-up
          12
          ·
          3 months ago

          When I left my last job they were using the zip file method for version control and one creative developer managed to link two versions of libc at the same time.

          Software is so useful that the standard for utility is extremely low.

    • MultipleAnimals@sopuli.xyz
      link
      fedilink
      arrow-up
      13
      ·
      edit-2
      3 months ago

      You can imagine how many node projects there are running in production with npm run. I have encountered js/ts/node devs that don’t even know that you should like, build your project, with npm build and then ship and serve the bundle.

    • Lupec@lemm.ee
      link
      fedilink
      arrow-up
      8
      ·
      3 months ago

      Lol my workplace ships Angular in debug mode. Don’t worry though, the whole page kills itself if a dubious third-party library detects the console is open. Very secure and not brittle at all! Please send help

      • Barbarian@sh.itjust.works
        link
        fedilink
        arrow-up
        4
        ·
        3 months ago

        Blink-blink-blink. Blink. Blink. Blink. Blink-blink-blink.

        No, I don’t have something in my eyes, I swear I’m fine looks nervously at boss.

  • vithigar@lemmy.ca
    link
    fedilink
    arrow-up
    11
    ·
    3 months ago

    For those of you who’ve never experienced the joy of PowerBuilder, this could often happen in their IDE due to debug mode actually altering the state of some variables.

    More specifically, if you watched a variable or property then it would be initialised to a default value by the debugger if it didn’t already exist, so any errors that were happening due to null values/references would just magically stop.

    Another fun one that made debugging difficult, “local” scoping is shared between multiple instances of the same event. So if you had, say, a mouse move event that fired ten times as the cursor transited a row and in that event you set something like integer li_current_x = xpos the most recent assignment would quash the value of li_current_x in every instance of that event that was currently executing.

    • mosiacmango@lemm.ee
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      3 months ago

      He worked for the gaming site/podcast “Giantbomb” years ago. Pretty sure the image macro is pulled from one of their podcast videos.

  • Nighed@sffa.community
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    1
    ·
    3 months ago

    Someone has a compiler if statement left somewhere in their code (… probably)

  • uranibaba@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    3 months ago

    I once had a bug in a C# program I wrote. It made a HTTP request and if the user agent was left to default (whatever that was), the server just gave back an empty string as a reply. I took way to long until I understood what was going on and I kept chasing async, thinking I had messed it up some how.

  • Treczoks@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    3 months ago

    Heisenbug. Nasty buggers, especially in my domain: Embedded Engineering. When you are in the debugger, the whole processor is stopped, missing tons of data coming in, missing interrupts, getting network timeouts, etc. More often than not, resuming makes no sense, and you have to get straight to reboot.