Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pendingHeartBeat timeout not cleared properly #42

Closed
pkozlowski-opensource opened this issue Jun 30, 2014 · 7 comments
Closed

pendingHeartBeat timeout not cleared properly #42

pkozlowski-opensource opened this issue Jun 30, 2014 · 7 comments

Comments

@pkozlowski-opensource
Copy link
Member

In ceratin circumstences the timeout here:

pendingHeartBeat = setTimeout(function() {
is not cleared properly and prevents Node.js process from exiting. This is not great since it makes the Gulp+Karma integration story more difficult. Manifestation of the situation can be sometimes in SauceLabs builds with this error:

ERROR [launcher.sauce]: Heartbeat to chrome 35 (Linux) failed

[title()] Not JSON response

ERROR Job xxx is not in progress. It may have recently finished, or experienced an error. You can learn more at https://saucelabs.com/jobs/xxx 

This error is logged since a heartbeat is scheduled even if a given browser finished its run.

@pkozlowski-opensource pkozlowski-opensource changed the title pendingHeartBeat timeout not cleared on the successful run (or some other strange timing issue) pendingHeartBeat timeout not cleared properly Jul 4, 2014
@pkozlowski-opensource
Copy link
Member Author

Narrowed down the problem: the heart-beat timeout isn't cleared when a browser fails to start and is killed + restarted by Karma. I'm not sure what is the exact sequence of events that make the problem appear, though.... But definitively it happens only when a browser fails to capture and is restarted by Karma. When a browser captures correctly the timeout is cleared properly.

@pkozlowski-opensource
Copy link
Member Author

OK, so here is the situation when a timeout might not get cleared properly:

  • A browser is requested on sauce and the selenium session starts properly
  • We are executing a request to open an initial URL:
    return driver.get(url).then(heartbeat, function(err) {
  • Capture timeout occurs so we are going into the kill procedure. But at this point the heartbeat timer wasn't started so there is nothing to clear
  • While the browser is being killed a response to the initial page arrives and installs a heartbeat timer that no one clears...

I can see 2 approaches to fixing the problem: either check before starting the heartbeat procedure that a browser is not being killed or clear the heartbeat timeout later, just before calling done. IMO the first approach sounds "better".

@ChrisWren
Copy link
Contributor

@pkozlowski-opensource thanks for investigating this, I haven't looked at the heartbeat code much but approach 1 does sound preferable.

@cellog
Copy link

cellog commented Jul 6, 2016

this is still an active issue, can you fix it soon? It's killing my test suite on travisci.

@ChrisWren
Copy link
Contributor

FYI: I no longer use or maintain this plugin

@lsm
Copy link

lsm commented Apr 8, 2018

This branch fixed the heartbeat problem:

edoardocavazza@5359b5f

Could someone review and merge it, please?

@wswebcreation
Copy link
Collaborator

Closing this due to inactivity, feel free to re-open if this is still an issue. Heartbeat has been re-implemented in https://github.com/karma-runner/karma-sauce-launcher/releases/tag/v4.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants