[Bug] [Issue #409] Lost background heart beat when running command

Hi

After a few hours of running I am getting an error message

lost background heart beat when running command

The message comes at random points through the macros and is not associated with a specific step. In general the script simply opens up websites clicks a few links, deletes cookies and moves onto a new website.

Anyone have any ideas how to resolve this.

Thanks
Nick

2 Likes

We have a few other reports of this issue, but we are still looking for a reliable way to recreate and fix this. Therefore, some question:

  • What kind of macro are you running (short or long macro? What does it do?)
  • How do you run it for hours? Are you using the LOOP button, or does the macro itself run for hours, e. g. with the Goto or while commands?

Hi

The macro is 750 lines long. It visits websites, pauses, deletes cookies and opens the next website.

The overall run time per macro is about 40 minutes (pauses of about 91 seconds).

I am using the loop button and it appears error up anywhere between 10 and 20 loops.

N

1 Like

Yeah, just saw this error as well today; running 3.1.9. 355 line macro

Do you guys use other browser at the same time the script is running or watch videos(youtube etc. or in an app)?
I figured if I leave the laptop alone I do not stuck upon this error. But I stuck on freezing without any error written to log.
And I can’t figure out if this is the same error with a little different indication or not.

Hi,

I am using it in a browser by itself. Nothing else running on the computer!

N

Just looked in the extensions errors console and saw

console.error(chrome.runtime.lastError.message + ', ’ + method + ', ’ + JSON.stringify(args));

I consistently get this error when using the “type” or “sendKeys” command with a textarea, when the value to type is very long (10,000+)
I am then using the following:

{
  "Command": "storeEval",
  "Target": "\"\\n50,000 extra chars:\\n\" + (new Array(1001).join(\"xyzab1234567890 xyzab1234567890 xyzab1234567890X,\\n\"))",
  "Value": "value50kCharacters"
},
{
  "Command": "type",
  "Target": "id=memo_field",
  "Value": "${value50kCharacters}"
},

HW specs: Macbook pro 2018; chrome 70.0; Kantu browser automation 3.3.3
Hope this helps in resolving it!

Hi @paulklinkenberg - this is a good test case, thanks!

I am facing this issue too in the lastest version, I have started yesterday then when come today show round 1/99 means don’t even completed the first loop ? (was stuck in open a page)

Google Chrome Version 71.0.3578.80 (Official Build) (32-bit)
Kantu 3.5.5

There is any option to enable datetime in the kantu logs history ?

thanks

@novo what kind of macro did you run? The test case from @paulklinkenberg turned out to be too artificial for debugging, as it freezes the web page. So we are still in search for a good use case that allows us to recreate and debug the “stop” use case.

If you need to run macros or test suites 24/7 the best solution is to use the Kantu command line - we have a good Powershell and (soon) Python example. Chrome and Firefox itself are not designed for 24/7 operation. So even without the “Lost background heart beat” bug, the browsers will react strange after several hours of non-stop automated web browsing. This happens with every automation solution, including Selenium Web Driver. That is why our Powershell script checks for a non-responsive browser and kills Chrome if needed.

I am just started using Kantu, so I am not have many experience yet.

But here just testing with to open a page then go to google and wait 2 hours (PAUSE 7200000) then open again the same page. (just for testing purpose because I don’t know yet how to do it with if/else )

I can see with Opera running more stable I think the same script running already 12/99 rounds.
But I do understand then to leave the script running 24/7 need to using command line stuff I will learn first the basics then I can try. thanks

I have running with linux machine and got this behavior too there is any example like powershell to shell script ? to check the browser ?

Maybe this helps? Powershell and Python command line example

1 Like

I have the same problem too.
Chrome Version 71.0.3578.98 (Official Build) (64-bit)
Kantu 3.7.2
The script has 32 commands; 166 lines in JSON
Let me know if you want the full script to run it on your side.

@ptalbot Yes, if we can run the script that would be great.

Here’s the script

{
“Name”: “SAQ_Search_Bing_Rouge_Page”,
“CreationDate”: “2019-1-12”,
“Commands”: [
{
“Command”: “store”,
“Target”: “0”,
“Value”: “loop_counter”
},
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!ErrorIgnore”
},
{
“Command”: “store”,
“Target”: “FAST”,
“Value”: “!replayspeed”
},
{
“Command”: “store”,
“Target”: “2000”,
“Value”: “!TIMEOUT_MACRO”
},
{
“Command”: “store”,
“Target”: “0”,
“Value”: “no_result”
},
{
“Command”: “while”,
“Target”: “${!statusOK}”,
“Value”: “”
},
{
“Command”: “storeEval”,
“Target”: “(${loop_counter} * 10) + 1”,
“Value”: “page_index”
},
{
“Command”: “echo”,
“Target”: “loop_counter ${loop_counter}”,
“Value”: “”
},
{
“Command”: “open”,
“Target”: “https://www.bing.com/search?q=“cote+des+experts”%2B"Fiche+produit"%2B"vin+rouge"%2B-“Ce+produit+est+épuisé”%2B-“pas+en+stock+”+site%3Awww.saq.com&first=${page_index}&FORM=PERE”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: “//[@id=“b_results”]/li/div/h2/a@href",
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: "//
[@id=“b_results”]/li[2]/div/h2/a@href”,
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: “//[@id=“b_results”]/li[3]/div/h2/a@href",
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: "//
[@id=“b_results”]/li[4]/div/h2/a@href”,
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: “//[@id=“b_results”]/li[5]/div/h2/a@href",
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: "//
[@id=“b_results”]/li[6]/div/h2/a@href”,
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: “//[@id=“b_results”]/li[7]/div/h2/a@href",
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: "//
[@id=“b_results”]/li[8]/div/h2/a@href”,
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: “//[@id=“b_results”]/li[9]/div/h2/a@href",
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeAttribute”,
“Target”: "//
[@id=“b_results”]/li[10]/div/h2/a@href”,
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “saq_save_rouge”,
“Value”: “”
},
{
“Command”: “storeEval”,
“Target”: “${loop_counter} + 1”,
“Value”: “loop_counter”
},
{
“Command”: “endWhile”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “localStorageExport”,
“Target”: “saq_save_rouge.csv”,
“Value”: “”
}
]
}Preformatted text

@ptalbot Thanks. Please also add the code tags, otherwise the code is difficult to copy.

I ran into this error too.
The script has 12 commands and the first one is the open-command that brought forth the error for me. :’)
It should be noted that I also tried running a different scrip (an earlier version of the current one, which ran just fine earlier without encountering the error) after encountering this error with my current one, and the error occurred then too.

Actually I just restarted my computer and ran the scripts (which earlier had given me the error) and they worked just fine about 5 minutes ago when I first posted this comment… except now when I try to run them I get the error again. :face_with_raised_eyebrow:

But the best and rock-solid way for automation that runs for days, weeks and months without interruption is ti use the command line and check the return codes of Kantu, see https://a9t9.com/kantu/docs#247