Skip to content
DevMeme
2095 of 7590
Bugs Post #2343 · source on Telegram

Elon Musk's public battle with a non-deterministic bug

Description

This image is a screenshot of a tweet from the verified Twitter account of Elon Musk (@elonmusk). The tweet reads: 'Something extremely bogus is going on. Ran my code four times. Two times it worked, two times it segfaulted. Same machine, same code, same inputs. Simple calculator written in NodeJS.' The profile picture is a photo of a rocket launch. This tweet became a popular meme in the developer community because it showcases a universally relatable and frustrating problem: a non-deterministic bug, often called a 'heisenbug.' The humor for experienced engineers stems from several layers: the public and somewhat dramatic debugging of a seemingly 'simple' program by a famous tech CEO, and the technical curiosity around a segmentation fault in Node.js. A segfault is a low-level memory error more typical of languages like C++, so its occurrence in a high-level environment like Node.js suggests a more complex issue, likely involving a misbehaving native C++ addon rather than the JavaScript code itself

Comments

21
Anonymous ★ Top Pick The only thing less deterministic than a race condition in a Node.js native addon is the stock price of a company that announces its CEO is debugging a calculator on Twitter
  1. Anonymous ★ Top Pick

    The only thing less deterministic than a race condition in a Node.js native addon is the stock price of a company that announces its CEO is debugging a calculator on Twitter

  2. Anonymous

    Nothing like realizing your ‘simple’ Node calculator pulls in six native NPM addons - congratulations, you’ve built Schrödinger’s malloc: 2 + 2 either equals 4 or segfaults the instant you attach gdb

  3. Anonymous

    The real bug here is expecting deterministic behavior from a Node.js app written by someone who thinks launching cars into space is easier than memory management. At least when SpaceX rockets crash, they don't segfault 50% of the time on identical inputs

  4. Anonymous

    Ah yes, the Schrödinger's Calculator - simultaneously working and segfaulting until you observe it in production. The fact that a 'simple calculator' in Node.js can segfault is the real tell here: someone's either invoking native addons for arithmetic (because why use JavaScript's perfectly good numbers when you can have memory unsafety?), or they've discovered that V8's JIT compiler has opinions about mathematical determinism. The 50% success rate suggests a race condition so perfectly balanced, Thanos would be proud. This is what happens when you need to calculate 2+2 but accidentally summon undefined behavior from the C++ layer beneath. Remember: in JavaScript, even your calculator can have trust issues

  5. Anonymous

    A NodeJS calculator that segfaults isn’t doing math - it’s a C++ addon teaching you quantum determinism. Ship a core dump, not a tweet

  6. Anonymous

    Node.js calculator: because who needs deterministic math when async roulette delivers 50% uptime?

  7. Anonymous

    “Simple calculator in Node.js” that segfaults 50% of the time is just your NAN-bound C++ addon racing the GC - libuv flipping a coin between numbers and a dangling pointer

  8. @sharp_mechanix 5y

    Node. Node never changes.

  9. Deleted Account 5y

    Scam

  10. Deleted Account 5y

    Oh, that is not that crypto shit

  11. @yrurunnin 5y

    And they still say C++ is more difficult than Node.js...

    1. Deleted Account 5y

      for c++ it is: two times it worked, two times it hang the whole machine

      1. @doodguy1991 5y

        Don't be retarded. Calculators don't cause segmentation faults unless you intentionally try to by adding pointers for no reason.

        1. Deleted Account 5y

          I got segmentation faults without using raw pointers, just with iterators, and it was in a calculator

  12. dev_meme 5y

    Context for all of yours: initially this tweet was about Covid19 test

    1. @bladefistx2 5y

      By elon musk

  13. @obemenko 5y

    Wake up. Remember about JavaScript. Your day is ruined

  14. Deleted Account 5y

    Yes

  15. Deleted Account 5y

    Node at least

  16. Deleted Account 5y

    I was amused at how much I had to fuck up the first time I got it

  17. Deleted Account 5y

    the trash itself no but the interpreter can

Use J and K for navigation