A while back I was developing a workflow scheduler. However the run duration kept coming back negative. The runs kept finishing like 15 seconds before they started. Eventually I figured out why; the company had configured a policy to use their custom NTP server, but it was 16.7 seconds off. So my Windows laptop’s time was in the future, but the WSL VM (which ran the program) used another NTP server and was correct. In the end I just added a bodge that made the program request the time from an external server on startup to calculate an offset.

  • skisnow@lemmy.ca
    link
    fedilink
    English
    arrow-up
    4
    ·
    6 hours ago

    3rd line support for a global IT brand you have heard of, on the kind of security product that people don’t like to mess with too much once it’s installed on their servers.

    Bug had been in the tracker over 3 years when I joined, and had defeated anyone who tried it. Segfault that happened to only one customer, unpredictably, and only once or twice a year, and nobody could reproduce it.

    After a few weeks of tracing the compiled code line-by-line I found a race condition in the teardown of an object. That’s not the silly part.

    I wrote the patch for the version of the code the customer was running and was hailed as a mighty hero and everyone on the bus clapped etc. Then I went to forward-port the patch to the newer versions of the program and… it was already fixed there. Some fucken doofus had either fixed the bug without realizing, or, fixed it and just skipped the standard backporting process that would normally patch all the other versions that were still in support.

  • exdor@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    6 hours ago

    My system didnt boot for obscure reasons

    Found out something had caused my nix store (packages) to explode in size. Chrooting didnt work as it was filled to the last byte. Deleted some files, then chrooted in and did a cleanup

  • jason@discuss.online
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    9 hours ago

    Back when I was learning c++ on Windows, I naively jumped right into game dev (as one does) before understanding the purpose of a debugger. I spent 3 months chasing down a period that should have been a comma. Due to function overloading, this was not an error or warning. It’s just silently calling the wrong function and crashing the program.

    Thus began my distrust of magic compiler features. To save typing a handful of characters, languages add new ways to blow off your own leg. Every time you blow off your leg, the time you lose is orders of magnitude greater than just being explicit. Just read this thread for more examples. Today, I program almost exclusively in C. I have no desire to use more feature-rich/higher level languages for anything.

  • nanometer1625@thelemmy.club
    link
    fedilink
    arrow-up
    10
    ·
    13 hours ago

    One time I was struggling to understand why a code branch I wrote was being unexpectedly taken, and I found that I had written something like if pet == 'cat' || 'dog'. Since 'dog' was a string, the condition was always true. I laughed out loud at myself.

  • kopasz7@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    16
    ·
    15 hours ago

    ECU (the computer in your car) only came online on the bus at every 3rd restart. No memory was written, yet the bastard somehow knew it anyway.

    Turns out the transciever’s enable pin was left unconfigured and supposedly some charge accumulated during two startups to set it.

  • Thebeardedsinglemalt@lemmy.world
    link
    fedilink
    arrow-up
    14
    ·
    18 hours ago

    I fixed a 5 year old issue that the previous guy claimed was “unfixable”. Turns out it was because someone copy-pasted a value from an Outlook email…and it had a single dash in it…which outlook converted to a double dash.

    • Giloron@programming.dev
      link
      fedilink
      arrow-up
      5
      ·
      15 hours ago

      That’s why I was so confused about the AI emdash connection. MS Office has been replacing dash with emdash for 20+ years.

      • thomasloven@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        7 hours ago

        I was confused too. But now I think it’s specifically em dashes in the middle of words, isn’t it? Like copy—paste instead of copy-paste?

    • monkeyman512@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      17 hours ago

      I have had issues of having the same characters but in Unicode failing. But if I type it manually or paste it into Notepad++ forcing it to ASCII first, it works.

  • MECHASQrL@lemmy.world
    link
    fedilink
    arrow-up
    18
    ·
    19 hours ago

    I can’t quite remember what I was debugging exactly, some constant was different in runtime compared to what was in code. Someone added a leading 0 to a const int to make the number align with others in terms of character count just to make it pretty I guess. That is when I learned about octal literals in C. I think that was the only time I’ve seen one in many years and it was used unintentionally. To save you a search leading 0 in C makes number to be base 8 same as 0x makes it hex aka base 16, so that inconspicuous 01000 is not a 1000 it’s a 512.

  • shalafi@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    17 hours ago

    This was dumb, and it was on me.

    Couldn’t figure out why two obscure software packages were erroring in a very particular way. Thinking there was no way in hell a search would help, I plugged it in Google. There was user on Spiceworks outlining my exact situation and fix. Who is this mad genius?!

    It was me. I fixed it two years previously and went back to note so in the forum.

  • ExtraMedicated@lemmy.world
    link
    fedilink
    English
    arrow-up
    49
    ·
    23 hours ago

    Internet Explorer didn’t automatically have “console.log” defined until you opened the console window. So there was an error breaking the web page that would disappear when you tried to open the console to see the error. The error was that console.log wasn’t defined. Fucking IE.

  • Simulation6@sopuli.xyz
    link
    fedilink
    arrow-up
    14
    ·
    19 hours ago

    Person before flipped a bunch of if checks to put the value before the variable (if 6==x rather then if x==6). They messed up a bunch of the <= and >= checks by forgetting to reverse them. I improved performance and fixed numerous bugs by tracking those down.

    • Feathercrown@lemmy.world
      link
      fedilink
      English
      arrow-up
      9
      ·
      18 hours ago

      Ah yes, yoda conditionals. Because guarding against accidentally typoing if(x=6) is worth destroying your code’s readability.

  • expletivedeleted@lemmy.zip
    link
    fedilink
    arrow-up
    21
    ·
    22 hours ago

    I was hired to work on a CMS designed for schools. I was tasked with debugging.

    I started off with the newest issues and worked my way back.

    Well, there was a bug where teachers would upload a video but it wouldn’t play on the page. It was plaguing a team of 8 for YEARS.

    It was mentioned in our morning standup, and I decided to fast track it.

    The dude who wrote the code was shrinking the display size in half: well how do you think that would work when a dimension of the video isn’t divisible by 2?

    So, remember, I am the new guy, quickly fixed it using an if/then and the % modulus operator, and lo and behold, the next morning standup I had to explain the fix in front of the project manager, his boss, and the entire team…

    fucking awkward. “You see, there’s this thing in division called a remainder.” This was the first thing in the morning.

    But because the bug had been so ever present, that’s why the boss’s boss attended the standup. God, I just wanted to die.

    • cristian64@reddthat.com
      link
      fedilink
      arrow-up
      5
      ·
      21 hours ago

      I don’t think I understand what the issue was or what the fix was. Was it a language or system that cannot perform the division with truncation?

      • expletivedeleted@lemmy.zip
        link
        fedilink
        arrow-up
        4
        ·
        19 hours ago

        Let’s say height and width are 320x214.

        (these numbers are arbitrarily chosen)

        The code was sizing it down by /2, so now it is 160 by 107.

        Because the width being odd, it would display.

        But:

        if ($width%2) { $width = --$width; }

        Hastily written out on the phone, but that was the fix. This was back with php 5.

          • notthebees@reddthat.com
            link
            fedilink
            arrow-up
            2
            ·
            6 hours ago

            You can’t halve a pixel. Truncating would get around the issue but big issue is that you can’t have a float as a video resolution. The browser should just truncate it regardless but the original code is flawed.

            OPs fix essentially does the same thing.

          • bitfucker@programming.dev
            link
            fedilink
            arrow-up
            6
            ·
            13 hours ago

            For a strong typed language, an integer division should not cast to any other data type. Even assigning a float to an integer should not be allowed (that’s why C is not really strongly typed). I think from the syntax it was PHP. If any of the dimensions were not divisible by 2, then the number changed from integer to float and it could cause an issue somewhere downstream the video processing pipeline.

            • notthebees@reddthat.com
              link
              fedilink
              arrow-up
              1
              ·
              7 hours ago

              I don’t think it’s reexporting a video or something, I think it’s the embed bc it is a CMS. PHP 5 isn’t that old so video in webpages isn’t a novel idea.

              But you’re right. Can’t halve a pixel.

              • bitfucker@programming.dev
                link
                fedilink
                arrow-up
                1
                ·
                5 hours ago

                Do note that PHP5 is old, predating HTML5. Browsers probably still struggle with malformed HTML and in the absence of any sane value, just crash. Also, who knows if it was even HTML. For all I know it could be a flash.

                • notthebees@reddthat.com
                  link
                  fedilink
                  arrow-up
                  1
                  ·
                  3 hours ago

                  Fuck, I forgot about Flash. I didn’t think it was that old. Odds are it’s just some other internal video player tbh.

            • cristian64@reddthat.com
              link
              fedilink
              arrow-up
              1
              ·
              12 hours ago

              OP didn’t say that the problem was with the change in type. I think the interesting part is the downstream issue: what failed when a float was given while an integer was expected?

          • expletivedeleted@lemmy.zip
            link
            fedilink
            arrow-up
            2
            ·
            12 hours ago

            Dude, this reminds me of my coworker who was setting up a network and was trying to figure out a subnet mask, and he said, “I am trying to find a subnet mask between /22 and /23.”

            He spent the entire day on it. I finally had to ask, and once he told me his goal, I of course asked, “how the fuck do you get half of a bit?”

            Oh, the blood drained from his face. “Yeah, bro, that’s CIDR.”

            How does this not make sense? I am spoon feeding this shit. Are you just vibe coding?

      • bss03@infosec.pub
        link
        fedilink
        English
        arrow-up
        3
        ·
        20 hours ago

        I think there are some versions of Python and/or PHP where the normal division operator silently promotes to IEEE floats, and you have to explicitly cast back to truncate/floor the value.