How to kill zombie tasks?

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
113
Баллы
43
I've posted this as bug a year or two years ago.
But still a problem, checked in our latest version (7.7.3RU)

106091


At all I've 4 active tasks, two of then with browser and another ones run without browser.
I have some "active" instances and this instances are "unkilable" (I don't know if this word exists, its something like immortal).

I think they are not a real active instance because it doesn't appear in taskmonitor and the resources of computer are fine.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 480
Благодарностей
5 917
Баллы
113
As far as I can see, many instances displayed as preparing (grey border)... seems they didn't even start...
Did I ask you to show the screenshot of Instance tab in project settings?
 

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
113
Баллы
43
No, it was taken form Zenno Poster, "Show Instances" button.
Not only grey border are zombies, some active (blue border) are zombies.

106110


106111
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 480
Благодарностей
5 917
Баллы
113

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
113
Баллы
43
7.7.3 I think it's default settings:

106115


7.4.0 Default settings too

106116
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 480
Благодарностей
5 917
Баллы
113

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
113
Баллы
43
I'll put it into 120 and check if it will solve.
But zombie instances appear after a project end into a bad end, I don't think it is related with load base, its something like unload.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 480
Благодарностей
5 917
Баллы
113
I'll put it into 120 and check if it will solve.
But zombie instances appear after a project end into a bad end, I don't think it is related with load base, its something like unload.
Then please give more details on how Bad End is set.
Also, don't you run instances using some custom method? like instance.Laounch or similar?
 

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
113
Баллы
43
Usually a bad end hava a simple breakpoint and there is a lot of bad end in the projects.
The last one bad end execute a SQL Server query.

Код:
ZennoLab.OwnCode.CommonCode.project = project;

string cn = project.Variables["cn"].Value;
string pv = project.Variables["pv"].Value;
string ad = project.Variables["ad"].Value;
string no = project.Variables["no"].Value;
string id = project.Variables["id"].Value;

//verifica se há uma cascata de pedidos pendentes
var tbl = project.Tables["ped"];
string rangePed = "";
for (int i = 0; i < tbl.RowCount; i++){
    rangePed +=  tbl.GetCell("A",i)+",";
}
rangePed = rangePed.TrimEnd(',').Trim();

//Verifica se o problema ocorreu duas horas após o início
string dtini = project.Variables["horaInicio"].Value;
DateTime ini = CommonCode.ConverteData(dtini,"yyyy-MM-dd HH:mm:ss",true);
DateTime fim = DateTime.Now;
TimeSpan ts = fim.Subtract(ini);
double horas = ts.TotalHours;

//mensagens de erro
string tipoErro = "Robo_" + cn; //+ "_Erro_Execução";
string erroMsg = string.Format("Erro origem: cn: {0} - ad: {1} - ID: {2}",cn,no,id);

//se for superior a duas horas altera o tipo do erro
if (horas > 2){
    tipoErro = "Robo_" + cn; //+ "_Erro_Timeout";
}

//adiciona mensagem ao projeto em execução e ao log
string msg = "Ops, algo de errado ocorreu, os pedidos foram agendados, a execução irá iniciar em duas horas";
CommonCode.MensagemProgressoId(id,msg);
project.SendInfoToLog(msg,true);

//Insere log geral
string query = string.Format("insert into log (LogId, LogDsc, LogDta) values ('{0}', '{1}', getdate())", tipoErro, erroMsg);
CommonCode.ExecutaQuery(query);

//monta lista de ids para dar update, se for um range
if (!rangePed.Equals(string.Empty)){
    tipoErro = "Robo_" + cn; //+ "_Agendamentos_Por_Erro";
    erroMsg = string.Format("Erro agendamentos: cn: {0} - ad: {1} - ID: {2}",cn,no,rangePed);
    query = string.Format("insert into log (LogId, LogDsc, LogDta) values ('{0}', '{1}', getdate())", tipoErro, erroMsg);
    CommonCode.ExecutaQuery(query);
    id = id+","+rangePed;
}

//Agenda todos para execução na próxima uma hora
query = string.Format(@"
    update
    pedad
    set
    pedsit = 7,
    pedage = DATEADD(MINUTE, 60, GETDATE())
    where
    pedId = {0}
    and pedSit <> 7
", id);
CommonCode.ExecutaQuery(query);
No one project use a custom run instance.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 480
Благодарностей
5 917
Баллы
113
Usually a bad end hava a simple breakpoint and there is a lot of bad end in the projects.
The last one bad end execute a SQL Server query.

Код:
ZennoLab.OwnCode.CommonCode.project = project;

string cn = project.Variables["cn"].Value;
string pv = project.Variables["pv"].Value;
string ad = project.Variables["ad"].Value;
string no = project.Variables["no"].Value;
string id = project.Variables["id"].Value;

//verifica se há uma cascata de pedidos pendentes
var tbl = project.Tables["ped"];
string rangePed = "";
for (int i = 0; i < tbl.RowCount; i++){
    rangePed +=  tbl.GetCell("A",i)+",";
}
rangePed = rangePed.TrimEnd(',').Trim();

//Verifica se o problema ocorreu duas horas após o início
string dtini = project.Variables["horaInicio"].Value;
DateTime ini = CommonCode.ConverteData(dtini,"yyyy-MM-dd HH:mm:ss",true);
DateTime fim = DateTime.Now;
TimeSpan ts = fim.Subtract(ini);
double horas = ts.TotalHours;

//mensagens de erro
string tipoErro = "Robo_" + cn; //+ "_Erro_Execução";
string erroMsg = string.Format("Erro origem: cn: {0} - ad: {1} - ID: {2}",cn,no,id);

//se for superior a duas horas altera o tipo do erro
if (horas > 2){
    tipoErro = "Robo_" + cn; //+ "_Erro_Timeout";
}

//adiciona mensagem ao projeto em execução e ao log
string msg = "Ops, algo de errado ocorreu, os pedidos foram agendados, a execução irá iniciar em duas horas";
CommonCode.MensagemProgressoId(id,msg);
project.SendInfoToLog(msg,true);

//Insere log geral
string query = string.Format("insert into log (LogId, LogDsc, LogDta) values ('{0}', '{1}', getdate())", tipoErro, erroMsg);
CommonCode.ExecutaQuery(query);

//monta lista de ids para dar update, se for um range
if (!rangePed.Equals(string.Empty)){
    tipoErro = "Robo_" + cn; //+ "_Agendamentos_Por_Erro";
    erroMsg = string.Format("Erro agendamentos: cn: {0} - ad: {1} - ID: {2}",cn,no,rangePed);
    query = string.Format("insert into log (LogId, LogDsc, LogDta) values ('{0}', '{1}', getdate())", tipoErro, erroMsg);
    CommonCode.ExecutaQuery(query);
    id = id+","+rangePed;
}

//Agenda todos para execução na próxima uma hora
query = string.Format(@"
    update
    pedad
    set
    pedsit = 7,
    pedage = DATEADD(MINUTE, 60, GETDATE())
    where
    pedId = {0}
    and pedSit <> 7
", id);
CommonCode.ExecutaQuery(query);
No one project use a custom run instance.
SQL query does not affect instance work.
Don't you set own user agent in browser profile or maybe run instance from code in your template?
 

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
113
Баллы
43
Yes, all the time I set user agent / browser profile by this code:

Код:
string tp = instance.BrowserType.ToString().ToLower();
if (tp.Equals("chrome")){
    tp = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36";
}
else{
    tp = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0";
}

project.Profile.UserAgent = tp;
project.Profile.UserAgentAppVersion = tp;
project.Profile.UserAgentLanguage = "pt-BR";
project.Profile.UserAgentBrowserLanguage = "pt-BR";
project.Profile.Country = "Brazil";
project.Profile.Town = "Rio de Janeiro";
project.Profile.AcceptLanguage = "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3";
project.Profile.AcceptEncoding = "gzip, deflate, br";
After set this, a start / esstart instance is executed.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 480
Благодарностей
5 917
Баллы
113
Yes, all the time I set user agent / browser profile by this code:

Код:
string tp = instance.BrowserType.ToString().ToLower();
if (tp.Equals("chrome")){
    tp = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36";
}
else{
    tp = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0";
}

project.Profile.UserAgent = tp;
project.Profile.UserAgentAppVersion = tp;
project.Profile.UserAgentLanguage = "pt-BR";
project.Profile.UserAgentBrowserLanguage = "pt-BR";
project.Profile.Country = "Brazil";
project.Profile.Town = "Rio de Janeiro";
project.Profile.AcceptLanguage = "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3";
project.Profile.AcceptEncoding = "gzip, deflate, br";
After set this, a start / esstart instance is executed.
This may be the reason.
 

Кто просматривает тему: (Всего: 3, Пользователи: 0, Гости: 3)