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.

you are viewing a single comment's thread
view the rest of the comments
[–] 31 points 1 day ago (6 children)

two days for an = instead of an ==

  • source
  • hideshow 6 child comments
  • [–] 7 points 1 day 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.

  • source
  • parent
  • [–] 10 points 1 day ago (4 children)

    "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.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 4 points 19 hours ago (3 children)

    Hope you never have to use a language that lets you redefine numbers.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 4 points 18 hours ago (2 children)

    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. :)

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 18 hours ago (1 child)

    Redefining the number 2 in Python

    The biggest const-by-default lang is probably Rust now isn't it?

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 17 hours 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.

  • source
  • parent