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.

  • lime!@feddit.nu
    link
    fedilink
    arrow-up
    117
    ·
    6 days ago

    i was just a user, but i debugged a weird issue where one of those blue light reduction programs would start flickering and inverting day and night time during june.

    turns out the dev had made the assumption that the sun always rises before it sets, and i was far enough north that the sun would start setting after midnight.

  • ExtraMedicated@lemmy.world
    link
    fedilink
    English
    arrow-up
    71
    ·
    6 days 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.

    • 87Six@lemmy.zip
      link
      fedilink
      arrow-up
      11
      ·
      5 days ago

      That would genuinely make me clock the fuck out for the day when I figured it out, jesus christ.

    • OldMrFish@feddit.dk
      link
      fedilink
      arrow-up
      3
      ·
      4 days ago

      Saw this way too many times. Eventually the first thing to check whenever a customer was having weird issues would be to check, if someone had accidentally left debugging comments in prod code…

  • The Bard in Green@lemmy.starlightkel.xyz
    link
    fedilink
    English
    arrow-up
    14
    ·
    4 days ago

    I’ve told this story before but we were supporting a custom ATS for a customer where we had this perfect storm happen.

    1. We had a bug in it that we sorted out eventually, where sometimes when you fed it input that contained weird characters, it would cause the name of a function or variable to get echoed in the nearby output. So if you had a variable called $debug_page or a function called $send_to_processing, and you input say some Arabic characters (this customer had many job applicants who were native Arabic speakers) you might get output that was the output you wanted + that string so

    Searching... 10 applicants found debug_page or Applicant: Mohammad Al-Saud send_to_processing.

    1. We had this developer who named things in lolcat speak. So a function might be called $ICanHaz($applicant) or $LongStringIsLong($string).

    So we got an email from the customer saying they had a VERY offended job applicant and what had happened. They had clicked the reject button on someone, which triggered the system to send an automatic rejection form letter to the applicant. This applicant had some Arabic character in their last name, which triggered the bug.

    And the reject applicant function had been written by this guy. So that poor applicant got an email that said

    Dear Applicant

    We have reviewed your application and while we thought you have an excellent background unfortunately we decided you are not a good fit for our company at this time… blah blah blah etc…

    YouCanHazNoJobKThanksBai

    • Buddahriffic@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      4 days ago

      Or variations of this caused by a makefile not having correct dependencies set up, eg it points to dependent source files but not the headers so header updates get ignored during compiles. Made me add a “make clean” step to the debug process of “change that should have fixed the issue appears to be doing nothing at all” issues, or even just defaulting to rebuilding everything because test times can take hours or even days to get to the issue, so I don’t want to waste that much time only to find out it’s still running the old version.

    • CookieOfFortune@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      4 days ago

      Back in the day not saving means you might lose your work during a crash. So ctrl-s after every change became habit even years into auto saving editors.

    • bss03@infosec.pub
      link
      fedilink
      English
      arrow-up
      4
      ·
      5 days ago

      Yep. Last time I used MS Visual Studio it was still all too eager to run an older binary, and I lot plenty of time debugging a binary that doesn’t reflect the current code. And, even more recently, when testing requires you to remember to run separate routines to upload to a testing server and restart a service, it is really easy to forget to do that when you are bouncing between the code and the browser console to figure out what to change.

  • kopasz7@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    27
    ·
    5 days 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.

  • skisnow@lemmy.ca
    link
    fedilink
    English
    arrow-up
    16
    ·
    5 days 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.

    • bss03@infosec.pub
      link
      fedilink
      English
      arrow-up
      15
      arrow-down
      1
      ·
      6 days ago

      “Yoda conditionals” are a must in languages where bindings/references are mutable by default. E.g.: “if (0 == size)” or “if (0x4269 == magic)”. If you write ‘=’ instead of ‘==’ you get a compiler error, so always put the constant first.

        • bss03@infosec.pub
          link
          fedilink
          English
          arrow-up
          6
          ·
          5 days ago

          Wasn’t there a Python version where True and False were mutable by accident?

          I tend to use languages where immutability is the default these days like Haskell, Idris, or Purescript. But, even when using Java and Javascript, I tossed around a lot more final / const than my peers. :)

            • bss03@infosec.pub
              link
              fedilink
              English
              arrow-up
              3
              ·
              5 days ago

              Maybe? I don’t really keep up with lang popularity. Got through the Rust tutorial and did one project with it, but I honestly was missing HKTs and (mostly) isolating effects based on type signature. Of course, Rust may have grown those features since then, it was last decade when I played with it.

    • naur@tech.pr0n.pl
      link
      fedilink
      English
      arrow-up
      10
      ·
      6 days ago

      I once spent several hours debugging a performance issue in the Linux builds of a project. The service worked fine on Windows but couldn’t keep up with the traffic when deployed on Linux. Interestingly, CPU load was actually higher on Windows, and no sampling profiler showed any suspicious hot spots.

      It turned out the problem was in the program’s main loop, which was OS-specific and called something like sleep(float seconds) (yes, I know…). The parameter was set to 1e-3 on Windows and 10e-3 on Linux. I stared at that line several times before I noticed the difference.


      Another time, all services of a distributed system were regularly reporting a loss of communication at 4 AM. The servers were supposed to receive data continuously, so even a few seconds of silence was enough to raise an alert.

      Half of the team investigated all kinds of possible locking scenarios (the applications were multi-threaded). Then we noticed that all the logs in the system (including the kernel’s) had the same gap in timestamps.

      Then someone remembered, that the customer had a cron job which did some maintenance at night. They confirmed that it halted the entire VM with all services for about 5 seconds.

  • Fargeol@lemmy.world
    link
    fedilink
    arrow-up
    53
    ·
    6 days ago

    I found an issue in a software used by government employees.
    A request would fail if the server and the client had different years in their system time which could happen if they were located in different time zones.
    After a few calculations I asked: “Hey, what are the chances a government employee would do this important task between 6pm and midnight on December 31st?”
    We decided not to prioritize the issue.

      • qaz@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        7
        ·
        edit-2
        5 days ago

        “Hey, what are the chances a government employee would do this important task between 6pm and midnight on December 31st?”

        I guess “this important task” could refer to firing a nuke, which to be fair is unlikely to happen at that moment in time (or any for that matter)

  • MECHASQrL@lemmy.world
    link
    fedilink
    arrow-up
    28
    ·
    5 days 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.

    • Dejected Warp Core@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      4 days ago

      It’s one of the most sneaky legacy foot-guns C (and C-like languages) have. I think we’re decades removed from using octal everywhere, except for Linux filesystem flags (which the letter-equivalents should probably be used instead).

  • shalafi@lemmy.world
    link
    fedilink
    English
    arrow-up
    25
    ·
    5 days 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.

  • hawgietonight@lemmy.world
    link
    fedilink
    arrow-up
    49
    ·
    6 days ago

    I’ve been a dev for years and had my fair share of sillyness… can’t recall which was the most silly, but one very recent one was trying to debug a weird error. So I opened the VS solution did a search for the string that spat out the error. Found it in a catch clause and stabbed that function with breakpoints, and went off to test.

    Hours later (too many to confess) after trying everything, I found out why I couldn’t get it to stop on the breakpoint. I had opened the wrong project, for the wrong app :O

    It was an unlucky coincidence that it had the same literal error trace in code!

  • Turret3857@infosec.pub
    link
    fedilink
    English
    arrow-up
    51
    arrow-down
    1
    ·
    6 days ago

    i was trying to figure out why ssh wasnt working only to realize I was using the wrong username. That took about 2 hours of time to realize as I was bashing my head at the wall while looking at the pubkey signature being the same on both machines.

  • Bassman1805@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    4 days ago

    I had a system that would fail if you ran it on leap days.

    It was used to calibrate equipment, and would generate a calibration certificate after the procedure was completed. One field in the certificate was “calibration due date”, which the program calculated by taking the current date and adding 1 to the year.

    Whoever wrote the program had enough foresight to use a datetime library that recognized “Feb 29, 2021” was not a valid date, but not enough foresight to use that library’s date math functions to add 365 days.

    The official solution was “just hold off on calibrations until tomorrow and we’ll fix that in the 2.0 calibration machine we’re working on.” The 2.0 machine was already years behind schedule, and I’m not sure it ever got completed after I left that company. I bet the bug still existed on Feb 29, 2024.

  • expletivedeleted@lemmy.zip
    link
    fedilink
    arrow-up
    27
    ·
    6 days 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.

    • Buddahriffic@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      4 days ago

      Ok, I understand the issue but I don’t understand your embarrassment from it. You didn’t write the initial bug.

      Btw, a faster way to check if a value is even is to just do a bitwise AND on bit 0 (if it is an integer, though it needs to be an integer for modulus to work anyways).

      In many languages it looks like:

      if ( val & 1 ) { \ it is odd }

      Division is a multi-cycle operation but bitwise comparisons are simple enough to be done in a single cycle, or could even be thrown on to instructions as a free extra that doesn’t add any extra cycles (eg any instruction with a bit mask, though it depends on the implementation as to whether it’s done for 0 extra cycles or more).

      Doesn’t really matter for a one off operation like halving the value of video display parameters, but if you have a loop that needs to check a lot of them, the bitwise and will pull ahead.

      And if you’re thinking “well we need to divide by 2 anyways and the modulus is available from that operation as long as the compiler sees it should save the result and the modulus”, a bitwise shift right (non-circular) of 1 is also way faster than divide by 2.

      Both of these can also be generalized for any power of 2, if necessary.

      • expletivedeleted@lemmy.zip
        link
        fedilink
        arrow-up
        2
        ·
        4 days ago

        Dude, the embarrassment was because I was the new kid.

        It was pointed out. It was a bug that had plagued the company. Thought this was all explained.

    • cristian64@reddthat.com
      link
      fedilink
      arrow-up
      9
      ·
      5 days 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
        5
        ·
        5 days 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.

          • bitfucker@programming.dev
            link
            fedilink
            arrow-up
            9
            ·
            5 days 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
              ·
              5 days 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 days 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
                  ·
                  5 days 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
              ·
              5 days 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?

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

                A few things, basically you can’t have half a pixel. Apparently html5, resolution in a video embed is an integer only. A browser would just truncate and cast it to an integer but that is malformed html. Also php5 predates html 5. So only god knows what the video player was doing.

          • expletivedeleted@lemmy.zip
            link
            fedilink
            arrow-up
            6
            ·
            5 days 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?

          • notthebees@reddthat.com
            link
            fedilink
            arrow-up
            3
            ·
            5 days 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.

      • bss03@infosec.pub
        link
        fedilink
        English
        arrow-up
        3
        ·
        5 days 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.