Portal SAMP
[Ajuda] Como evitar isso - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] Como evitar isso (/showthread.php?tid=4762)



Como evitar isso - welmateus - 09/05/2024

Galera, estou desde ontem monitorando meu servidor e otimizando várias coisas, porém, eu uso uma include: EVF, e tem uma callback OnVehicleTimeUpdate que está sendo chamada muitas vezes e lotando o server.log.
Código:
[08:46:38] [debug] #0 00034e28 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2480
[08:46:38] [debug] Long callback execution detected (hang or performance issue)
[08:46:38] [debug] AMX backtrace:
[08:46:38] [debug] #0 00034ecc in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2482
[08:46:39] [debug] Long callback execution detected (hang or performance issue)
[08:46:39] [debug] AMX backtrace:
[08:46:39] [debug] #0 00035434 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2501
[08:46:40] [debug] Long callback execution detected (hang or performance issue)
[08:46:40] [debug] AMX backtrace:
[08:46:40] [debug] #0 00034d54 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2478
[08:46:41] [debug] Long callback execution detected (hang or performance issue)
[08:46:41] [debug] AMX backtrace:
[08:46:41] [debug] #0 00034df0 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2480
[08:46:41] [debug] Long callback execution detected (hang or performance issue)
[08:46:41] [debug] AMX backtrace:
[08:46:41] [debug] #0 00034e74 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2481
[08:46:42] [debug] Long callback execution detected (hang or performance issue)
[08:46:42] [debug] AMX backtrace:
[08:46:42] [debug] #0 00034ea8 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2482
[08:46:43] [debug] Long callback execution detected (hang or performance issue)
[08:46:43] [debug] AMX backtrace:
[08:46:43] [debug] #0 0003542c in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2500
[08:46:44] [debug] Long callback execution detected (hang or performance issue)
[08:46:44] [debug] AMX backtrace:
[08:46:44] [debug] #0 00034da0 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2479
[08:46:45] [debug] Long callback execution detected (hang or performance issue)
[08:46:45] [debug] AMX backtrace:
[08:46:45] [debug] #0 00034ebc in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2482
[08:46:46] [debug] Long callback execution detected (hang or performance issue)
[08:46:46] [debug] AMX backtrace:
[08:46:46] [debug] #0 00035b30 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2550
[08:46:47] [debug] Long callback execution detected (hang or performance issue)
[08:46:47] [debug] AMX backtrace:
[08:46:47] [debug] #0 00034d84 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2478
[08:46:47] [debug] Long callback execution detected (hang or performance issue)
[08:46:47] [debug] AMX backtrace:
[08:46:47] [debug] #0 00034d28 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2478
[08:46:48] [debug] Long callback execution detected (hang or performance issue)
[08:46:48] [debug] AMX backtrace:
[08:46:48] [debug] #0 00034e5c in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2481
[08:46:49] [debug] Long callback execution detected (hang or performance issue)
[08:46:49] [debug] AMX backtrace:
[08:46:49] [debug] #0 00034e48 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2480
[08:46:50] [debug] Long callback execution detected (hang or performance issue)
[08:46:50] [debug] AMX backtrace:
[08:46:50] [debug] #0 000353ec in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2500
[08:46:51] [debug] Long callback execution detected (hang or performance issue)
[08:46:51] [debug] AMX backtrace:
[08:46:51] [debug] #0 00035b18 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2550
[08:46:51] [debug] Long callback execution detected (hang or performance issue)
[08:46:51] [debug] AMX backtrace:
[08:46:51] [debug] #0 00034dc0 in public OnVehicleTimeUpdate () at C:\Users\Administrator\Downloads\GM New Generation RP 1.0\pawno\include\EVF.inc:2479
Callback que está na include:
Código:
EVF::Public:: OnVehicleTimeUpdate(){
    new Float:EVF::Vec[4];
    EVF::ForeachVehicle(vehicleid){
        if(EVF::VehicleProperty[vehicleid][e_VEHICLE_STORED]){
            GetVehiclePos(vehicleid,EVF::Vec[0],EVF::Vec[1],EVF::Vec[2]);
            GetVehicleZAngle(vehicleid,EVF::Vec[3]);
            if(IsVehicleSticky(vehicleid)){
                if(VectorSize(EVF::Vec[0]-EVF::VehicleTempData[vehicleid][e_pos_x],EVF::Vec[1]-EVF::VehicleTempData[vehicleid][e_pos_y],EVF::Vec[2]-EVF::VehicleTempData[vehicleid][e_pos_z]) >= 2.0 || VectorSize(EVF::Vec[3]-EVF::VehicleTempData[vehicleid][e_pos_a],0.0,0.0) >= 1.0){
                    return TeleportVehicle(vehicleid,EVF::VehicleTempData[vehicleid][e_pos_x],EVF::VehicleTempData[vehicleid][e_pos_y],EVF::VehicleTempData[vehicleid][e_pos_z],EVF::VehicleTempData[vehicleid][e_pos_a],GetVehicleInterior(vehicleid),GetVehicleVirtualWorld(vehicleid));
                }
            }
            #if defined OnVehiclePosChange
                if(VectorSize(EVF::Vec[0]-EVF::VehicleTempData[vehicleid][e_pos_x],EVF::Vec[1]-EVF::VehicleTempData[vehicleid][e_pos_y],EVF::Vec[2]-EVF::VehicleTempData[vehicleid][e_pos_z]) >= 2.0){
                    if(CallRemoteFunction("OnVehiclePosChange","iffffffff",vehicleid,EVF::Vec[0],EVF::Vec[1],EVF::Vec[2],EVF::Vec[3],EVF::VehicleTempData[vehicleid][e_pos_x],EVF::VehicleTempData[vehicleid][e_pos_y],EVF::VehicleTempData[vehicleid][e_pos_z],EVF::VehicleTempData[vehicleid][e_pos_a])){
                        EVF::VehicleTempData[vehicleid][e_pos_x] = EVF::Vec[0];
                        EVF::VehicleTempData[vehicleid][e_pos_y] = EVF::Vec[1];
                        EVF::VehicleTempData[vehicleid][e_pos_z] = EVF::Vec[2];
                        EVF::VehicleTempData[vehicleid][e_pos_a] = EVF::Vec[3];
                    } else {
                        return TeleportVehicle(vehicleid,EVF::VehicleTempData[vehicleid][e_pos_x],EVF::VehicleTempData[vehicleid][e_pos_y],EVF::VehicleTempData[vehicleid][e_pos_z],EVF::VehicleTempData[vehicleid][e_pos_a],GetVehicleInterior(vehicleid),GetVehicleVirtualWorld(vehicleid));
                    }
                }
            #endif

            GetVehicleVelocity(vehicleid,EVF::Vec[0],EVF::Vec[1],EVF::Vec[2]);
            if(IsVehicleFuelToggled(vehicleid)){
                //fuel system
                new Float:vehicle_speed = EVF::GetVehicleSpeed(vehicleid);
                //if vehicle out of fuel
                if(GetVehicleFuel(vehicleid) <= 0){
                    SetVehicleParams(vehicleid,VEHICLE_TYPE_ENGINE,0);
                    new vehicle_driver = GetVehicleDriverID(vehicleid);
                    if(IsPlayerConnected(vehicle_driver)){
                        GameTextForPlayer(vehicle_driver,"~r~Vehicle out of fuel !",5000,3);
                    }
                } else {
                    //if vehicle has some EVF::Vecitive fuel
                    EVF::VehicleTempData[vehicleid][e_uptime] += 1;
                    if(EVF::VehicleTempData[vehicleid][e_uptime] > 20){ // 250 ms * 20 = 5 seconds
                        EVF::VehicleTempData[vehicleid][e_uptime] = 0;
                        
                        new fuel_consumption_level = 0;
                        if(vehicle_speed == 0.0){
                            if(GetVehicleParams(vehicleid,VEHICLE_TYPE_ENGINE)){
                                fuel_consumption_level = MULTIPLIER_FUEL_SYSTEM;
                            }
                        } else {
                            for(new i = 20, j = floatround(GetVehicleTopSpeed(vehicleid)); i <= j; i += 20){
                                if(vehicle_speed > i){
                                    fuel_consumption_level += MULTIPLIER_FUEL_SYSTEM;
                                }
                            }
                        }
                        
                        if(fuel_consumption_level > 0){
                            new old_fuel = GetVehicleFuel(vehicleid), new_fuel = (old_fuel - fuel_consumption_level - 1);
                            if(new_fuel < 0) new_fuel = 0;
                            CallRemoteFunction("OnVehicleFuelChange","iii",vehicleid,new_fuel,old_fuel);
                            SetVehicleFuel(vehicleid,new_fuel);
                        }
                    }
                }
            }
            
            #if defined OnVehicleVelocityChange
                if(CallRemoteFunction("OnVehicleVelocityChange","iffffff",vehicleid,EVF::Vec[0],EVF::Vec[1],EVF::Vec[2],EVF::VehicleTempData[vehicleid][e_vel_x],EVF::VehicleTempData[vehicleid][e_vel_y],EVF::VehicleTempData[vehicleid][e_vel_z])){
                    EVF::VehicleTempData[vehicleid][e_vel_x] = EVF::Vec[0];
                    EVF::VehicleTempData[vehicleid][e_vel_y] = EVF::Vec[1];
                    EVF::VehicleTempData[vehicleid][e_vel_z] = EVF::Vec[2];
                } else {
                    return SetVehicleVelocity(vehicleid,EVF::VehicleTempData[vehicleid][e_vel_x],EVF::VehicleTempData[vehicleid][e_vel_y],EVF::VehicleTempData[vehicleid][e_vel_z]);
                }
            #endif
            
            GetVehicleHealth(vehicleid,EVF::Vec[0]);
            #if defined OnVehicleHealthChange
                if(EVF::Vec[0] != EVF::VehicleTempData[vehicleid][e_health]){
                    if(CallRemoteFunction("OnVehicleHealthChange","iff",vehicleid,EVF::Vec[0],EVF::VehicleTempData[vehicleid][e_health])){
                        EVF::VehicleTempData[vehicleid][e_health] = EVF::Vec[0];
                    } else {
                        return SetVehicleHealth(vehicleid,EVF::VehicleTempData[vehicleid][e_health]);
                    }
                }
            #endif
        }
    }
    return 1;
}



RE: Como evitar isso - BitSain - 09/05/2024

Você pode ignorar isso.
O plugin está te dando um aviso de que alguma callback está demorando para ser lida.

Você pode desabilitar essas mensagens com essa função ao carregar sua GM (eu prefiro não usar isso, mas caso queira....)
Código PHP:
DisableCrashDetectLongCall(); 

Mas esse aviso não é um 'Indicador de problemas'.
Isso pode ser normal, em caso de loop por exemplo.

Um exemplo desse aviso fornecido pelo próprio autor do plugin (LOOP como citado acima):
( AVISO / ERRO )
Código PHP:
// FLAGS: -d3
// OUTPUT: Start
// OUTPUT: \[debug\] Long callback execution detected \(hang or performance issue\)
// OUTPUT: \[debug\] AMX backtrace:
// OUTPUT: \[debug\] #0 00000[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F] in main \(\) at .*long_call_error\.pwn:(15|16|17)
// OUTPUT: 100000

#include "test"

main() {
 print("Start");

 new x 0;

 for (new 0100000i++) {
  x += floatround(floatlog(1010));
 }

 printf("%d"x);


( CÓDIGO CORRIGIDO, AGORA SEM O AVISO)
Código PHP:
// FLAGS: -d3
// OUTPUT: Start
// OUTPUT: 1000

#include "test"

main() {
    print(
"Start");

    new 
0;

    for (new 
01000i++) {
        
+= floatround(floatlog(1010));
    }

    
printf("%d"x);




RE: Como evitar isso - welmateus - 09/05/2024

(09/05/2024 09:51)BitSain Escreveu: Você pode ignorar isso.
O plugin está te dando um aviso de que alguma callback está demorando para ser lida.

Você pode desabilitar essas mensagens com essa função ao carregar sua GM (eu prefiro não usar isso, mas caso queira....)
Código PHP:
DisableCrashDetectLongCall(); 

Mas esse aviso não é um 'Indicador de problemas'.
Isso pode ser normal, em caso de loop por exemplo.

Um exemplo desse aviso fornecido pelo próprio autor do plugin (LOOP como citado acima):
( AVISO / ERRO )
Código PHP:
// FLAGS: -d3
// OUTPUT: Start
// OUTPUT: \[debug\] Long callback execution detected \(hang or performance issue\)
// OUTPUT: \[debug\] AMX backtrace:
// OUTPUT: \[debug\] #0 00000[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F] in main \(\) at .*long_call_error\.pwn:(15|16|17)
// OUTPUT: 100000

#include "test"

main() {
 print("Start");

 new x 0;

 for (new 0100000i++) {
  x += floatround(floatlog(1010));
 }

 printf("%d"x);


( CÓDIGO CORRIGIDO, AGORA SEM O AVISO)
Código PHP:
// FLAGS: -d3
// OUTPUT: Start
// OUTPUT: 1000

#include "test"

main() {
    print(
"Start");

    new 
0;

    for (new 
01000i++) {
        
+= floatround(floatlog(1010));
    }

    
printf("%d"x);


Entendi, por um acaso você teria um contato para serviços pagos?


RE: Como evitar isso - BitSain - 09/05/2024

(09/05/2024 10:09)welmateus Escreveu:
(09/05/2024 09:51)BitSain Escreveu: Você pode ignorar isso.
O plugin está te dando um aviso de que alguma callback está demorando para ser lida.

Você pode desabilitar essas mensagens com essa função ao carregar sua GM (eu prefiro não usar isso, mas caso queira....)
Código PHP:
DisableCrashDetectLongCall(); 

Mas esse aviso não é um 'Indicador de problemas'.
Isso pode ser normal, em caso de loop por exemplo.

Um exemplo desse aviso fornecido pelo próprio autor do plugin (LOOP como citado acima):
( AVISO / ERRO )
Código PHP:
// FLAGS: -d3
// OUTPUT: Start
// OUTPUT: \[debug\] Long callback execution detected \(hang or performance issue\)
// OUTPUT: \[debug\] AMX backtrace:
// OUTPUT: \[debug\] #0 00000[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F] in main \(\) at .*long_call_error\.pwn:(15|16|17)
// OUTPUT: 100000

#include "test"

main() {
 print("Start");

 new x 0;

 for (new 0100000i++) {
  x += floatround(floatlog(1010));
 }

 printf("%d"x);


( CÓDIGO CORRIGIDO, AGORA SEM O AVISO)
Código PHP:
// FLAGS: -d3
// OUTPUT: Start
// OUTPUT: 1000

#include "test"

main() {
    print(
"Start");

    new 
0;

    for (new 
01000i++) {
        
+= floatround(floatlog(1010));
    }

    
printf("%d"x);


Entendi, por um acaso você teria um contato para serviços pagos?

Tenho sim por email: bitsaindeveloper@gmail.com
Mas no momento pra projetos eu não tou disponível, só serviços 'pequenos', devido ao projeto que eu estou atualmente.