115

I have found a... strange, to say the least, error on Stack Overflow. I was just browsing normally and I decided to open the error console, and I saw this:

Uncaught TypeError: Cannot call method 'isHeartBeating' of undefined

I thought that was a bit odd, so I found the line on which the error was:

StackExchange.cardiologist.isHeartBeating()

Stack Exchange has a cardiologist? And it can't tell if my heart is beating?! Are we in a Q&A site or an inexperienced hospital?

Here is some context for that code:

case "answer-add":0==$("#answer-"+d.answerid).length&&(p.push(d.answerid),StackExchange.cardiologist.isHeartBeating()?StackExchange.helpers.DelayedReaction(k,5E3).trigger():k(),StackExchange.cardiologist.notifiedOfNewAnswer());break;

And here it is more readable:

case "answer-add":
  0 == $("#answer-"+d.answerid).length &&
    (p.push(d.answerid),
    StackExchange.cardiologist.isHeartBeating() ?
    StackExchange.helpers.DelayedReaction(k,5E3).trigger() :
    k(),StackExchange.cardiologist.notifiedOfNewAnswer());
break;

And here it is from the dev code:

function postAnswerAdd(post) {
    if ($('#answer-' + post.answerid).length != 0) return;

    answersToShow.push(post.answerid);

    if (StackExchange.cardiologist.isHeartBeating()) {
        var newAnswers = StackExchange.helpers.DelayedReaction(showNewAnswerNotification, 5000);
        newAnswers.trigger();
    } else {
        showNewAnswerNotification();
    }

    StackExchange.cardiologist.notifiedOfNewAnswer();
}

What is this strange error?

(note: it is on line 18 of https://cdn.sstatic.net/js/full.js?v=2cb347042411)

24
  • 2
    Probably some appropriately named function to see if you're around.
    – animuson StaffMod
    Apr 24, 2013 at 12:29
  • thanks @Antony, I never knew that was there
    – Doorknob
    Apr 24, 2013 at 12:31
  • 26
    @Antony but it is much funnier watching people un-minifiy by hand! Apr 24, 2013 at 12:31
  • @Doorknob for development purposes it is actually multiple sensibly sized / scoped scripts; we combine, minify, and cdn-push as part of deployment Apr 24, 2013 at 12:34
  • 3
    for now I'll add a "Is there a doctor in the house?" check before expecting said medic to jump in "stat", but I'll need to check (with a colleague) what the intended behavior was there... Apr 24, 2013 at 12:35
  • 5
    meta.stackexchange.com/questions/111581/…
    – balpha StaffMod
    Apr 24, 2013 at 12:40
  • 25
    Oh, and I also explain in a comment why I chose that name: // I would have called it "heartbeatManager", but the boss doesn't like that: http://www.codinghorror.com/blog/2006/03/i-shall-call-it-somethingmanager.html
    – balpha StaffMod
    Apr 24, 2013 at 12:42
  • 12
    He's dead, Jim.
    – tombull89
    Apr 24, 2013 at 13:01
  • 12
    And here I expected to see this title was a bad analogy! Imagine my surprise to see it was literal! Apr 24, 2013 at 18:04
  • 5
    Please tell if you are in need of CPR. Apr 24, 2013 at 19:13
  • 2
    // There can be several hearts in a page. I approve of this Time Lord technology Apr 24, 2013 at 22:15
  • 2
    I think heartbeat is a technical term in computer systems. See the following definition. computer.yourdictionary.com/heartbeat Jul 8, 2013 at 10:47
  • 3
    I just got 10k, and now I see the mess below... :(
    – Doorknob
    Oct 16, 2013 at 20:58
  • 1
    After the Great Meta Split, the link posted by @Antony no longer works. It's now meta.dev.stackexchange.com/content/js/full.js (no idea why they flipped the order of meta and dev...)
    – user259867
    May 10, 2014 at 21:53
  • 2
    Have you notified the Mayo Clinic yet?
    – dan
    Apr 2, 2015 at 14:29

1 Answer 1

8

EDIT: This question is about a bug that was fixed about about 2.5 years ago (per Adam Lear), despite this question not appearing to have any submitted answers until now.

Stack Exchange has a cardiologist?

Yes, actually, in a way. There has been a background object called "StackExchange.cardiologist".

And it can't tell if my heart is beating?!

More precisely, the error you found means that the cardiologist cannot be found, not that the cardiologist can't tell if a heart is beating. And the "heartbeat" being referenced is background communication between the StackExchange page in your browser and a StackExchange server. "Heartbeat" is a bit of a misnomer for such meaningful communication. But still, the communication is periodic (it happens regularly), just like a real animal's heartbeat.

Are we in a Q&A site or an inexperienced hospital?

Haha -- But all jokes aside, a Q&A site. A Q&A site with back-end programmers who come up with all kinds of names for the parameters and objects that are usually entirely behind-the-scenes.

What is this strange error? ["Uncaught TypeError: Cannot call method 'isHeartBeating' of undefined"]

Beyond what was referenced above -- that there is code that cannot call the method 'isHeartBeating' because it doesn't have a valid connection or reference to a 'cardiologist' object -- beyond that, it's nothing to be too concerned about unless you're noticing problems in front-end functionality, like difficulty reading or posting a question, answer, or comment. (And you haven't mentioned any such difficulty.) Yes, it's a bug, and it's good to report such things, but it's more of a curiosity than a real problem based on the way the question has been phrased, no?

Reference: What is sent and received from the server during a "heartbeat" and how often does it beat? (with thanks to @balpha for providing that link in a comment)

1
  • 5
    "Yes, it's a bug, and it's good to report such things, but it's more of a curiosity than a real problem based on the way the question has been phrased, no?" - it's also a bug that was fixed about 2.5 years ago. :) We appreciate hearing about all bugs, not just ones that are immediately apparent. There's degrees of severity, for sure, but a bug's a bug and leads to some broken functionality even if it's not dire.
    – Adam Lear StaffMod
    Feb 16, 2016 at 3:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .