Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 06-02-2017
Avatar de noshy
noshy noshy is offline
Miembro
 
Registrado: jul 2003
Posts: 139
Poder: 21
noshy Va por buen camino
Un error que ni EurecaLog detecta!!!

Hola gente, como estan? la verdad yo hace varios dias que no duermo tratando de encotnrar un error en una aplicacion que tengo.

Les comento:

Esta aplicacion esta instalada en un servidor Windows Server 2008 R2, es una aplicacion que basicamente escucha un puerto socket (tidTcpServer indy10.6), está desarrollada en Rad Studio XE5.

Con esta aplicacion controlo una app (solo para android) para guardar en una database la posicion del celular.

En realidad, con respecto al codigo no tengo ningun problema, la aplicacion funciona perfectamente, pero de vez en cuando, sin tener intervalos determinados me aparece el error que muestro en la imagen.

A veces puede estar 10 minutos y parece, a veces puede pasar dias sin aparecer y ya no se que hacer, cuando los tirna la aplicacion sigue funcionando pero si lo dejo al juntar tantos error me genera un error critico en el server y debo reiniciarlo.

He probado con EurekaLog y no me detecta absolutamente nada, inclusive el error de la imagen es la aplicacion con eureka, me parece queel problema es de un nivel mas bajo que el codigo, pero ya no se que hacer.

Si a alguien le ha aparecido, si pueden dilucidar que es, se lo agradeceria.

__________________
\_--> NoShY <--_/
Responder Con Cita
  #2  
Antiguo 06-02-2017
Avatar de noshy
noshy noshy is offline
Miembro
 
Registrado: jul 2003
Posts: 139
Poder: 21
noshy Va por buen camino
Me van a preguntar del codigo, lo agrego por las dudas.

Lo subo en un archivo adjunto ya que posee mas 50.000 caracteres y el mensaje me permite 30.000.
Archivos Adjuntos
Tipo de Archivo: rar codigo.rar (7,0 KB, 16 visitas)
__________________
\_--> NoShY <--_/
Responder Con Cita
  #3  
Antiguo 07-02-2017
Avatar de AgustinOrtu
[AgustinOrtu] AgustinOrtu is offline
Miembro Premium
NULL
 
Registrado: ago 2013
Ubicación: Argentina
Posts: 1.858
Poder: 15
AgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en bruto
Hola noshy, te confieso que no he mirado el código.

Lo que te puedo recomendar es que agregues logs a tú aplicación. La idea es ir llevando el registro de lo que va pasando. Asi podes ir acercándote cada vez más al lugar el donde ocurre la excepción y bajo qué contexto.

Tenés habilitado el reporte de Eureka log? Genera un archivo con la traza y mucha más información muy útil
Responder Con Cita
  #4  
Antiguo 07-02-2017
Avatar de MAXIUM
MAXIUM MAXIUM is offline
Miembro
 
Registrado: may 2005
Posts: 1.488
Poder: 20
MAXIUM Va camino a la fama
No he revisado el código aún pero mis preguntas son
- ¿Es una aplicación o un servicio?
- ¿Se inicia solo o hay que iniciarlo? Si es lo primero ¿que sucede si se resetea el Servidor y a los minutos u horas, se bloquea la pantalla (no confundir con el protector de pantalla) como suele suceder en estos sistemas?
- ¿Que sucede si se pierde la conexión?
Responder Con Cita
  #5  
Antiguo 07-02-2017
bitbow bitbow is offline
Miembro
 
Registrado: jul 2006
Posts: 366
Poder: 18
bitbow Va camino a la fama
Otra pregunta importante seria
¿Usas componentes externos? alguna dll que pudiera estar presentando un error y que no dependa en si de tu aplicacion.

Saludos.
__________________
¡Ni como ayudarte Niño!!
bitbow
Responder Con Cita
  #6  
Antiguo 07-02-2017
Avatar de Al González
[Al González] Al González is offline
In .pas since 1991
 
Registrado: may 2003
Posts: 5.604
Poder: 29
Al González Es un diamante en brutoAl González Es un diamante en brutoAl González Es un diamante en brutoAl González Es un diamante en bruto
Yo te pediría, para empezar, que mostraras el primer mensaje de error que te sale (el de la ventana que está hasta atrás). ¿Es igual al resto?
Responder Con Cita
  #7  
Antiguo 07-02-2017
Avatar de noshy
noshy noshy is offline
Miembro
 
Registrado: jul 2003
Posts: 139
Poder: 21
noshy Va por buen camino
Cita:
Empezado por AgustinOrtu Ver Mensaje
Hola noshy, te confieso que no he mirado el código.

Lo que te puedo recomendar es que agregues logs a tú aplicación. La idea es ir llevando el registro de lo que va pasando. Asi podes ir acercándote cada vez más al lugar el donde ocurre la excepción y bajo qué contexto.

Tenés habilitado el reporte de Eureka log? Genera un archivo con la traza y mucha más información muy útil
Hola, gracias por responder, si lo tengo habilitado y no encuentra ningun tipo de error, es mas el codigo lo tengo en su totalidad con try / except y tampoco me toma la exception.
Tambien habilite para que chequeara los threads, ya que cada lectura del socket lo realiza en un thread diferente.

Cita:
Empezado por MAXIUM Ver Mensaje
No he revisado el código aún pero mis preguntas son
- ¿Es una aplicación o un servicio?
- ¿Se inicia solo o hay que iniciarlo? Si es lo primero ¿que sucede si se resetea el Servidor y a los minutos u horas, se bloquea la pantalla (no confundir con el protector de pantalla) como suele suceder en estos sistemas?
- ¿Que sucede si se pierde la conexión?
Hola, gracias por responder, si, por ahora es una aplicacion, hay que iniciarlo manualmente, tengo personal las 24 hs, asi que si se corta la conexion o se resetea el servidor, siempre hay gente para levantar todo.

Cita:
Empezado por bitbow Ver Mensaje
Otra pregunta importante seria
¿Usas componentes externos? alguna dll que pudiera estar presentando un error y que no dependa en si de tu aplicacion.

Saludos.
Hola, gracias por responder, no uso nada externo, tengo una conexion ADO a la base de tatos y el componente indy para el socket.
Creo y destruyo Query's en cada sentencia SQL.



Cita:
Empezado por Al González Ver Mensaje
Yo te pediría, para empezar, que mostraras el primer mensaje de error que te sale (el de la ventana que está hasta atrás). ¿Es igual al resto?
Hola, gracias por responder, Son todos iguales los mensajes y una curiosidad, tambien es la misma address 00000000000002C8 en todas las ejecuciones.



He limpiado un poco el codigo, sacando todos los try / except para ver si me salta el error en alguna linea y nada, me sigue saltando el mismo error.

He estado investigando un poco y me estoy tirando por el lado de que windows server 2008 R2 tenga un limite de conexiones TCP pero no he encontrado nada concreto y calculo yo que me deberia ingorar el resto de las conexiones y no tirarme el error que estoy teniendo (https://www.outsystems.com/forums/di...-web-requests/).

Algo muy curioso es que me levanta el uso de la memoria, al iniciar comienza con 10 mb y despues de toda la noche llego a 73 mb, revise de destruir todos los componentes creados pero sigue igual.

Editado:

Otro dato, tengo habilitado el evento OnException del componente Indy y tampoco me toma la exception por ahi, me larga el dialogo directamente.
__________________
\_--> NoShY <--_/
Responder Con Cita
  #8  
Antiguo 07-02-2017
Avatar de noshy
noshy noshy is offline
Miembro
 
Registrado: jul 2003
Posts: 139
Poder: 21
noshy Va por buen camino
Código Delphi [-]
procedure TFDespachoAutomatico.server2Execute(AContext: TIdContext);
var
  vDespDatoRec       : string;  //Guarda la Cadena Recibida
  vDespRespLogin     : Integer; //Resuesta del Login
  vDespJSONDato      : TlkJSONobject;
  vDespJSONRespuestaFinal : TlkJSONobject;
  vDespJSONRespuestaLogin : TlkJSONobject;
  vDespUsuario       : string;  //Usuario logueado
  vDespLoginVersion  : string;
  vDespAuxS          : string;  //Variable Auxiliar String
  vDespTipoDato      : Integer; //Tipo de dato solicitado
  vDespMovil         : Integer; //Movil que envia la posicion
  vDespIdViaje       : Integer;   //Id Viaje Datos
  vDespIdViajeEnUso  : Integer; //Id Viaje En Uso
  vDespDomicilio     : string;
  vDespObservaciones : string;
  vDespViajeLat      : string;
  vDespViajeLng      : string;
  vDespRespS         : string;
  vDespMsgError      : string;



        //Funcion IdViajeEnusoInt ----------------------------------------------
        function IdViajeEnusoInt(vIdViaje: Integer):Integer;
        var
          vQryVEU : TADOQuery;
        begin
          Result := 0;
          vQryVEU            := TADOQuery.Create(nil);
          vQryVEU.Connection := conDB1;
          try
            with vQryVEU do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select idViajeEnUso from AppViajes_DatoViajes with (NOLOCK) where ');
              SQL.Add('id = :vIdViaje ');
              Parameters.ParamByName('vIdViaje').Value := vIdViaje;
              Open;
            end;
            if vQryVEU.RecordCount > 0 then
              Result := vQryVEU['idViajeEnUso']
            else
              Result := 0;
          finally
            FreeAndNil(vQryVEU);
          end;
        end;
        //Fin Funcion IdViajeEnusoInt ------------------------------------------

        //Funcion GrabarLogint -------------------------------------------------
        procedure GrabarlogInt(vDato, vCarpeta : string);
        var
         F: TextFile;
         Nombre :string;
        begin
          try
            if not DirectoryExists(GetCurrentDir + '\Log') then
              CreateDir(GetCurrentDir + '\Log');

            if not DirectoryExists(GetCurrentDir + '\Log\' + vCarpeta) then
              CreateDir(GetCurrentDir + '\Log\' + vCarpeta);

            nombre:=GetCurrentDir + '\Log\' + vCarpeta + '\' + FormatDateTime('YYYYMMDD',Now) + '.log';

            AssignFile(F, nombre);

            if (FileExists(nombre)) then
              Append(F)
            else
              ReWrite(F);

            if vCarpeta = 'Despacho' then
              Writeln(F, vDato )
            else
              Writeln(F, '['+DateTimeToStr(Now)+'] '+ vDato );
          finally
            CloseFile(F);
          end;
        end;
        //Fin Funcion GrabarLogint ---------------------------------------------

        //Funcion LogInt -------------------------------------------------------
        procedure LogInt(vDespLog: string; vDespTipo: Integer);
        begin
          case vDespTipo of
           0: begin //Log Errores
                GrabarlogInt(vDespLog,'Errores');  //Log Errores
                //Mostramos el log
                mmoErrores.Lines.Add(DateTimeToStr(Now)+' - '+vDespLog);
                //Booramos el excedente de 100 lineas
                if mmoErrores.Lines.Count > 20 then
                begin
                   mmoErrores.Lines.Delete(0);
                   mmoErrores.Lines.Delete(0);
                end;
                SendMessage(mmoErrores.Handle, EM_SCROLL, SB_BOTTOM, 0);
              end;
           1: begin //Log Crudo
                GrabarlogInt(vDespLog,'Crudo');  //Log Crudo
                if chkLogCrudo.Checked then
                begin
                  //Mostramos el log
                  mmoLog.Lines.Add(DateTimeToStr(Now)+' - '+vDespLog);
                  //Booramos el excedente de 100 lineas
                  if mmoLog.Lines.Count > 20 then
                  begin
                     mmoLog.Lines.Delete(0);
                     mmoLog.Lines.Delete(0);
                  end;
                  SendMessage(mmoLog.Handle, EM_SCROLL, SB_BOTTOM, 0);
                end;
              end;
           2: begin //Log Viajes
                GrabarlogInt(vDespLog,'Viajes');  //Log Viajes
                if chkLogViaje.Checked then
                begin
                  //Mostramos el log
                  mmoLog.Lines.Add(DateTimeToStr(Now)+' - '+vDespLog);
                  //Booramos el excedente de 100 lineas
                  if mmoLog.Lines.Count > 20 then
                  begin
                     mmoLog.Lines.Delete(0);
                     mmoLog.Lines.Delete(0);
                  end;
                  SendMessage(mmoLog.Handle, EM_SCROLL, SB_BOTTOM, 0);
                end;
              end;
          end;
        end;
        //Fin Funcion LogInt ---------------------------------------------------

        //Funcion DatoViajesInt ------------------------------------------------
        function DatoViajesInt(vDespLeido : Boolean; vDespRespuesta, vDespId: Integer):Boolean;
        var
          vQryDato : TADOQuery;
        begin
          Result := True;
          vQryDato            := TADOQuery.Create(nil);
          vQryDato.Connection := conDB;
          try
            with vQryDato do
            begin
              Close;
              SQL.Clear;
              SQL.Add('update AppViajes_DatoViajes set leido = :vleido, respuesta = :vrespuesta ');
              if vDespRespuesta = 1 then
              begin
                SQL.Add(',TipoDato = 2 ');
              end;
              SQL.Add('where id = :vid ');
              Parameters.ParamByName('vleido').Value     := vDespLeido;
              Parameters.ParamByName('vrespuesta').Value := vDespRespuesta;
              Parameters.ParamByName('vid').Value        := vDespId;
              ExecSQL;
            end;
          finally
            FreeAndNil(vQryDato);
          end;
        end;
        //Fin Funcion DatoViajesInt ----------------------------------

        //Procedimiento GuardarPosicionInt -------------------------------
        procedure GuardarPosicionInt(vDespMovil, vDespEstado, vDespConConsulta: Integer; vDespLat, vDespLng: string; vDespFecha: TDateTime );
        var
          vCant : Integer;
          vQryGP  : TADOQuery;
        begin
          vQryGP := TADOQuery.Create(nil);
          vQryGP.Connection := conDB;
          try
            with vQryGP do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select count(*) as total from AppViajes_UltimaPosicion with (NOLOCK) where movil = :movil');
              Parameters.ParamByName('movil').Value := vDespMovil;
              Open;
            end;
            vCant := vQryGP['total'];
            if vCant > 0 then
            begin
              with vQryGP do
              begin
                Close;
                SQL.Clear;
                SQL.Add('update AppViajes_UltimaPosicion set lat = :lat, lng = :lng, fecha = :fecha, estado = :estado, conConsulta = :conConsulta');
                SQL.Add('where movil = :movil');
                Parameters.ParamByName('lat').Value         := vDespLat;
                Parameters.ParamByName('lng').Value         := vDespLng;
                Parameters.ParamByName('fecha').Value       := vDespFecha;
                Parameters.ParamByName('estado').Value      := vDespEstado;
                Parameters.ParamByName('conConsulta').Value := vDespConConsulta;
                Parameters.ParamByName('movil').Value       := vDespMovil;
                ExecSQL;
              end;
            end
            else
            begin
              with vQryGP do
              begin
                Close;
                SQL.Clear;
                SQL.Add('Insert into AppViajes_UltimaPosicion(movil, lat, lng, fecha, estado, conConsulta)');
                SQL.Add('Values(:movil, :lat, :lng, :fecha, :estado, :conConsulta)');
                Parameters.ParamByName('movil').Value       := vDespMovil;
                Parameters.ParamByName('lat').Value         := vDespLat;
                Parameters.ParamByName('lng').Value         := vDespLng;
                Parameters.ParamByName('fecha').Value       := vDespFecha;
                Parameters.ParamByName('estado').Value      := vDespEstado;
                Parameters.ParamByName('conConsulta').Value := vDespConConsulta;
                ExecSQL;
              end;
            end;
          finally
            FreeAndNil(vQryGP);
          end;
        end;
        //FIN Procedimiento GuardarPosicion --------------------------------------

        //Funcion PosicionInt --------------------------------------------------
        function PosicionInt(vDespCadena: string):Boolean;
        var
          vJSONPosicion : TlkJSONobject;
          vMovil : Integer;
          vLat, vLng : string;
          vEstado : Integer;
        begin
          vJSONPosicion := TlkJSON.ParseText(vDespCadena) as TlkJSONobject;
          Result := False;
          try
            vMovil  := StrToInt(vartostr(vJSONPosicion.Field['posicion'].Field['movil'].Value));
            vLat    := vartostr(vJSONPosicion.Field['posicion'].Field['lat'].Value);
            vLat := ReplaceStr(Trim(vLat), '.', ',');
            vLng    := vartostr(vJSONPosicion.Field['posicion'].Field['lng'].Value);
            vLng := ReplaceStr(Trim(vLng), '.', ',');
            vEstado := StrToInt(vartostr(vJSONPosicion.Field['posicion'].Field['estado'].Value));

            if vEstado = 0 then
              vEstado := 3;

            if vEstado = 1 then
              vEstado := 2;

            GuardarPosicionInt(vMovil, vEstado, 0, vLat, vLng, now );
            Result := True;
          finally
            FreeAndnil(vJSONPosicion);
          end;
        end;
        //Fin Funcion PosicionInt ----------------------------------------------

        //Funcion PendienteLatInt ----------------------------------------------
        function PendienteLatInt(vDespIdViajeEnuso: Integer):string;
        var
          vQryLat : TADOQuery;
        begin
          Result := '';
          vQryLat            := TADOQuery.Create(nil);
          vQryLat.Connection := conDB;
          try
            with vQryLat do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select p.Lat from sat_viajespendientes p, AppViajes_ViajesEnUso u with (NOLOCK) where ');
              SQL.Add('p.id = u.idViajePendiente ');
              SQL.Add('and u.id = :vidviajeenuso ');
              Parameters.ParamByName('vidviajeenuso').Value := vDespIdViajeEnuso;
              Open;
            end;
            if vQryLat.RecordCount > 0 then
              Result := vQryLat['Lat']
            else
              Result := '';
          finally
            FreeAndNil(vQryLat);
          end;
        end;
        //Fin Funcion PendienteLatInt ------------------------------------------

        //funcion PendienteLngInt ----------------------------------------------
        function PendienteLngInt(vIdViajeEnuso: Integer):string;
        var
          vQryLng : TADOQuery;
        begin
          Result := '';
          vQryLng            := TADOQuery.Create(nil);
          vQryLng.Connection := conDB;
          try
            with vQryLng do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select p.Lng from sat_viajespendientes p, AppViajes_ViajesEnUso u with (NOLOCK) where ');
              SQL.Add('p.id = u.idViajePendiente ');
              SQL.Add('and u.id = :vidviajeenuso ');
              Parameters.ParamByName('vidviajeenuso').Value := vIdViajeEnuso;
              Open;
            end;
            if vQryLng.RecordCount > 0 then
              Result := vQryLng['Lng']
            else
              Result := '';
          finally
            FreeAndNil(vQryLng);
          end;
        end;
        //Fin funcion PendienteLngInt ------------------------------------------

        //Funcion ArmarDomicilioInt --------------------------------------------
        function ArmarDomicilioInt(vDomIdViajeEnuso: Integer):string;
        var
          vQryCalle : TADOQuery;
          vDomicilioArmado : string;
          vPiso, vDpto : string;
        begin
          vDomicilioArmado := '';
          Result := '';
          try
            vQryCalle            := TADOQuery.Create(nil);
            vQryCalle.Connection := conDB;
            with vQryCalle do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select p.calle, p.altura, p.piso, p.dpto from sat_viajespendientes p, AppViajes_ViajesEnUso u with (NOLOCK) where ');
              SQL.Add('p.id = u.idViajePendiente ');
              SQL.Add('and u.id = :vidviajeenuso ');
              Parameters.ParamByName('vidviajeenuso').Value := vDomIdViajeEnuso;
              Open;
            end;
            vDomicilioArmado := Trim(vQryCalle['calle']);
            vDomicilioArmado := vDomicilioArmado + ' ' + IntToStr(vQryCalle['altura']);

            try
              vPiso := Trim(vQryCalle['piso']);
              vDpto := Trim(vQryCalle['dpto']);
            except
              vPiso := '';
              vDpto := '';
            end;

            if vPiso.Length > 0 then
              vDomicilioArmado := vDomicilioArmado + ' Piso '+Trim(vQryCalle['piso']);

            if vDpto.Length > 0 then
              vDomicilioArmado := vDomicilioArmado + ' Dpto '+Trim(vQryCalle['dpto']);

            Result := vDomicilioArmado;

          finally
            FreeAndNil(vQryCalle);
          end;

        end;
        //Fin Funcion ArmarDomicilioInt ----------------------------------------

        //Funcion PendienteObservacionesInt ------------------------------------
        function PendienteObservacionesInt(vObsIdViajeEnuso: Integer):string;
        var
          vQryObservaciones : TADOQuery;
        begin
          Result := '';
          vQryObservaciones            := TADOQuery.Create(nil);
          vQryObservaciones.Connection := conDB;
          try
            with vQryObservaciones do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select p.observaciones from sat_viajespendientes p, AppViajes_ViajesEnUso u with (NOLOCK) where ');
              SQL.Add('p.id = u.idViajePendiente ');
              SQL.Add('and u.id = :vidviajeenuso ');
              Parameters.ParamByName('vidviajeenuso').Value := vObsIdViajeEnuso;
              Open;
            end;
            if vQryObservaciones.RecordCount > 0 then
              Result := vQryObservaciones['observaciones']
            else
              Result := '';
          finally
            FreeAndNil(vQryObservaciones);
          end;
        end;


        //Funcion PendienteBarrioInt -------------------------------------------
        function PendienteBarrioInt(vBarrioIdViajeEnuso: Integer):string;
        var
          vQryBarrio : TADOQuery;
        begin
          Result := '';
          vQryBarrio            := TADOQuery.Create(nil);
          vQryBarrio.Connection := conDB;
          try
            with vQryBarrio do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select p.barrio from sat_viajespendientes p, AppViajes_ViajesEnUso u with (NOLOCK) where ');
              SQL.Add('p.id = u.idViajePendiente ');
              SQL.Add('and u.id = :vidviajeenuso ');
              Parameters.ParamByName('vidviajeenuso').Value := vBarrioIdViajeEnuso;
              Open;
            end;
            while not vQryBarrio.Eof do
            begin
              Result := Trim(vQryBarrio['barrio']);
              vQryBarrio.Next;
            end;

          finally
            FreeAndNil(vQryBarrio);
          end;
        end;
        //Fin Funcion PendienteBarrioInt ---------------------------------------

        //Funcion PendienteInfoTmpInt ------------------------------------------
        function PendienteInfoTmpInt(vInfoIdViajeEnuso: Integer):string;
        var
          vQryInfoTmp : TADOQuery;
        begin
          Result := '-';
          vQryInfoTmp            := TADOQuery.Create(nil);
          vQryInfoTmp.Connection := conDB;
          try
            with vQryInfoTmp do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select p.infotmp from sat_viajespendientes p, AppViajes_ViajesEnUso u with (NOLOCK) where ');
              SQL.Add('p.id = u.idViajePendiente ');
              SQL.Add('and u.id = :vidviajeenuso ');
              Parameters.ParamByName('vidviajeenuso').Value := vInfoIdViajeEnuso;
              Open;
            end;
            try
              Result := Trim(vQryInfoTmp['infotmp'])
            except
              Result := '-';
            end;
          finally
            FreeAndNil(vQryInfoTmp);
          end;
        end;
        //Fin Funcion PendienteInfoTmpInt --------------------------------------

        //Funcion ControlInt ---------------------------------------------------
        function ControlInt(vDespControlMovil: Integer):string;
        var
          vDespQryControl  : TADOQuery;
          //vDespCadenaCtr   : string;
          vDespJSONControl : TlkJSONobject;
          vDespText, vObs  : string;
          vDespIdViaje     : Integer;
          vDespBarrio      : string;
        begin
          Result := '';
          vDespQryControl := TADOQuery.Create(nil);
          vDespQryControl.Connection := conDB1;
          vDespJSONControl  := TlkJSONobject.Create;
          try
            with vDespQryControl do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select id, movil, texto, idViajeEnUso ');
              SQL.Add('from AppViajes_DatoViajes with (NOLOCK) where ');
              SQL.Add('movil = :vctrmovil and ');
              SQL.Add('tipodato = 1 and leido = 0 ');  //que tipodato = 1 (proposicion) y no este leido
              Parameters.ParamByName('vctrmovil').Value := vDespControlMovil;
              Open;
            end;

            //SI tiene viaje asignado
            while not vDespQryControl.Eof do
            begin
              //vText    := LimpiarTexto(vQryViajes['texto']);
              vDespText    := vDespQryControl['texto'];
              vDespIdViaje := vDespQryControl['id'];

              vDespBarrio  := PendienteBarrioInt(vDespQryControl['idViajeEnUso']);
              if vDespBarrio.Length > 0 then
                vObs := 'Barrio: '+vDespBarrio
              else
                vObs := '';

              //vObs     :=  vObs +' '+  LimpiarTexto(PendienteInfoTmp(vQryViajes['idViajeEnUso']));
              vObs     :=  vObs +' '+  PendienteInfoTmpInt(vDespQryControl['idViajeEnUso']);

              vDespJSONControl.Add('domicilio', vDespText);  //Domicilio
              vDespJSONControl.Add('obs', vObs);             //Observaqciones
              vDespJSONControl.Add('idviaje', vDespIdViaje); //Id VIaje

              //Se marca el viaje como leido y se devuelve la cadena co el viaje
              if DatoViajesInt(True, 0,vDespQryControl['Id']) then //cambiamos el viaje a leido
              begin
                Result := TlkJSON.GenerateText(vDespJSONControl);
              end;

              vDespQryControl.Next;
            end;
          finally
            FreeAndNil(vDespQryControl);
            FreeAndnil(vDespJSONControl);
          end;
        end;
        //Fin Funcion ControlInt -----------------------------------------------

        //Funcion ControlQTAInt ------------------------------------------------
        function ControlQTAInt(vDespQTAMovil: Integer):string;
        var
          vDespQryViajesQTA    : TADOQuery;
          vDespJSONControlQTA : TlkJSONobject;
          //vDespCadena: string;
          vDespIdViaje: Integer;
        begin
          vDespQryViajesQTA := TADOQuery.Create(nil);
          vDespQryViajesQTA.Connection := conDB2;
          vDespJSONControlQTA  := TlkJSONobject.Create;
          try
            //CONTROL DE VIAJES QTA ------------------------------------------------------
            with vDespQryViajesQTA do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select id, movil, idViajeEnUso ');
              SQL.Add('from AppViajes_DatoViajes with (NOLOCK) where ');
              SQL.Add('tipodato = 3 and leido = 0 and ');  //que tipodato = 3 (CANCELADO) y no este leido
              SQL.Add('movil = :vvqtamovil ');
              Parameters.ParamByName('vvqtamovil').Value := vDespQTAMovil;
              Open;
            end;
            //SI tiene viaje asignado
            while not vDespQryViajesQTA.Eof do
            begin
              vDespIdViaje := vDespQryViajesQTA['id'];

              vDespJSONControlQTA.Add('estado', 'qta');  //estado
              vDespJSONControlQTA.Add('movil', IntToStr(vDespQTAMovil));  //movil
              vDespJSONControlQTA.Add('idviajeqta', vDespIdViaje); //Id VIaje

              if DatoViajesInt(True, 0,vDespQryViajesQTA['Id']) then //cambiamos el viaje a leido
              begin
                Result := TlkJSON.GenerateText(vDespJSONControlQTA);
              end;

              vDespQryViajesQTA.Next
            end;
          finally
            FreeAndNil(vDespQryViajesQTA);
            FreeAndnil(vDespJSONControlQTA);
          end;
        end;
        //Fin Funcion ControlQTAInt --------------------------------------------

        //Funcion LoginInt -----------------------------------------------------
        function LoginInt(vDespCadena: string):Integer;
        var
          vDespJSONLogin : TlkJSONobject;
          vDespUser, vDespPass: string;
          vDespQryLogin : TADOQuery;
        begin
          Result := 3; //Por defecto lo ponemos como error interno al resultado
          vDespQryLogin := TADOQuery.Create(nil);
          vDespQryLogin.Connection := conDB;

          vDespUser := '-';
          vDespPass := '-';
          //Creamos el objeto con el json enviado
          vDespJSONLogin := TlkJSON.ParseText(vDespCadena) as TlkJSONobject;
          try
            try
              vDespUser := vartostr(vDespJSONLogin.Field['login'].Field['user'].Value);
              vDespPass := vartostr(vDespJSONLogin.Field['login'].Field['pass'].Value);
            except
              Result := 3; //Error interno
              //Exit;
            end;

            //Validacion del usuario
            with vDespQryLogin do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select count(*) as total from AppViajes_Choferes with (NOLOCK) where usuario = :vusu and password = :vpass ');
              Parameters.ParamByName('vusu').Value  := vDespUser;
              Parameters.ParamByName('vpass').Value := vDespPass;
              Open;
            end;
            if vDespQryLogin['total'] > 0 then
            begin
              Result := 0; //Ingreso permitido
            end
            else
            begin
              Result := 1; //Ingreso denegado
            end;
          finally
            FreeAndNil(vDespQryLogin);
            FreeAndnil(vDespJSONLogin);
          end;
        end;
        //Fin Funcion LoginInt -------------------------------------------------

        //Funcion ValidarMovilQRXInt -------------------------------------------
        function ValidarMovilQRXInt(vMovilQRX: Integer):string;
        var
          vFecha     : TDateTime;
          //vOrigenQRX : string;
          qryQRX     : TADOQuery;
          vJSONQRX   : TlkJSONobject;
          s          : string;
          vResultado :  Boolean;
        begin
          qryQRX            := TADOQuery.Create(nil);
          qryQRX.Connection := conDB;
          vJSONQRX := TlkJSONobject.Create;
          try
            Result := '{}';
            vResultado := False; //QAP

            //Validamos si el movil se encuentra QRX
            with qryQRX do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select GETDATE() as fecha ');
              Open;
            end;
            vFecha := qryQRX['fecha']; //Obtenermos la fecha del server
            with qryQRX do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select nromovil,indefinido,fechafin from sat_movilesqrx with (NOLOCK) where nromovil = :vmov ');
              SQL.Add('and fechainicio <= GETDATE()  ');
              Parameters.ParamByName('vmov').Value := vMovilQRX;
              Open;
            end;
            while not qryQRX.Eof do
            begin
              if qryQRX['nromovil'] = vMovilQRX then
              begin
                if qryQRX['indefinido']= 's' then
                begin
                  vResultado := True; //QRX sin fecha de fin
                end
                else
                begin
                  if vFecha < qryQRX['fechafin'] then
                  begin
                    vResultado := True; //QRX dentro de la fecha de fin
                  end;
                end;
              end;
              qryQRX.Next;
            end;

            if vResultado then
              vJSONQRX.Add('estado', 'QRX')
            else
              vJSONQRX.Add('estado', 'QAP');
            //------------------------------------------------------
            s := TlkJSON.GenerateText(vJSONQRX);

            Result := s;
          finally
            FreeAndNil(qryQRX);
            FreeAndnil(vJSONQRX);
          end;
        end;
        //Fin Funcion ValidarMovilQRXInt ---------------------------------------

        //Funcion UsuarioMovilInt ----------------------------------------------
        function UsuarioMovilInt(vUsuario: string): Integer;
        var
          vQryMovil : TADOQuery;
        begin
          vQryMovil := TADOQuery.Create(nil);
          vQryMovil.Connection := conDB;
          try
            //Validacion del usuario
            with vQryMovil do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select movil from AppViajes_Choferes with (NOLOCK) where usuario = :vusu');
              Parameters.ParamByName('vusu').Value  := Trim(vUsuario);
              Open;
            end;
            try
              Result := vQryMovil['movil'];
            except
              Result := 0;
            end;
          finally
            FreeAndNil(vQryMovil);
          end;
        end;
        //Fin Funcion UsuarioMovilInt ------------------------------------------

        //Funcion ViajesInt ----------------------------------------------------
        function ViajesInt(vViajeMovil: Integer):String;
        var
          vJSONViajes : TlkJSONobject;
          vQryViajes  : TADOQuery;
          vCount      : integer;
          s : string;
          vTotal : integer;
          vTexto : string;
        begin
          Result := '';
          vQryViajes := TADOQuery.Create(nil);
          vQryViajes.Connection := conDB;
          vJSONViajes := TlkJSONobject.Create;
          try
            with vQryViajes do
            begin
              Close;
              SQL.Clear;
              SQL.Add('Select top 5 calle, altura, fechaenviado, estado from sat_viajesenviadostmp with (NOLOCK) where movil = :vmovil ');
              SQL.Add('order by fechaenviado desc ');
              Parameters.ParamByName('vmovil').Value := vViajeMovil;
              Open;
            end;

            try
              vTotal := vQryViajes.RecordCount;
            except
              vTotal := 0;
            end;
            //Log(IntToStr(vTotal)+' Viajes');

            vCount := 1;

            //Log('Reg: '+IntToStr(vQry.RecordCount));

            while not vQryViajes.Eof do
            begin
              //vJSONRes.Add('dv'+IntToStr(vCount), '['+DateToStr(vQry['fecha'])+'] $'+FloatToStrF(vQry['deuda'],ffFixed,14,2)+'-'+trim(vQry['detalle']) );
              vTexto := '['+DateTimeToStr(vQryViajes['fechaenviado'])+'] '+Trim(vQryViajes['calle'])+' '+IntToStr(vQryViajes['altura']);
              if vQryViajes['estado'] = 'QTA' then
                 vTexto := vTexto +' ['+vQryViajes['estado']+']';
              vJSONViajes.Add('viaje'+IntToStr(vCount), vTexto);
              /////
              vCount := vCount + 1;
              vQryViajes.Next;
            end;
            //El en ultimo registro colocamos el total de viajes----
            vJSONViajes.Add('total', IntToStr(vTotal));
            //------------------------------------------------------

            s := TlkJSON.GenerateText(vJSONViajes);

            Result := s;

          finally
            FreeAndNil(vQryViajes);
            FreeAndnil(vJSONViajes);
          end;
        end;
        //Fin Funcion ViajesInt ------------------------------------------------
__________________
\_--> NoShY <--_/
Responder Con Cita
  #9  
Antiguo 07-02-2017
Avatar de noshy
noshy noshy is offline
Miembro
 
Registrado: jul 2003
Posts: 139
Poder: 21
noshy Va por buen camino
Código Delphi [-]
begin
  //Recibimos la cadena
  try
    vDespDatoRec := AContext.Connection.IOHandler.ReadLn();
  except
    Exit;
  end;

  if vDespDatoRec.Length < 5 then
  begin
    Exit;
  end;

  //Mostramos la cadena en el log
  logInt(vDespDatoRec,1);


  //Verificamos el tipo de campo que manda el JSON
  vDespTipoDato := 0; //Por defecto tipo de dato 0 (nada)

  //Mensaje de error por defecto en blanco
  vDespMsgError := '';


  vDespJSONDato := TlkJSON.ParseText(vDespDatoRec) as TlkJSONobject;
  try
    try
      vDespUsuario  := vartostr(vDespJSONDato.Field['login'].Field['user'].Value);
      vDespTipoDato := 1; //login
    except

    end;

    try
      vDespLoginVersion := vartostr(vDespJSONDato.Field['login'].Field['version'].Value);
    except
      vDespLoginVersion := '1';
    end;

    try
      vDespMovil := StrToInt(vartostr(vDespJSONDato.Field['posicion'].Field['movil'].Value));
      vDespTipoDato := 2; //Posicion
    except

    end;

    try
      vDespMovil   := StrToInt(vartostr(vDespJSONDato.Field['viajeaceptado'].Field['movil'].Value));
      vDespIdViaje := StrToInt(vartostr(vDespJSONDato.Field['viajeaceptado'].Field['idviaje'].Value));
      vDespTipoDato := 3; //Viaje Aceptado
    except

    end;

    try
      vDespMovil   := StrToInt(vartostr(vDespJSONDato.Field['viajerechazado'].Field['movil'].Value));
      vDespIdViaje := StrToInt(vartostr(vDespJSONDato.Field['viajerechazado'].Field['idviaje'].Value));
      vDespTipoDato := 4; //Viaje Rechazado
    except

    end;

    try
      vDespMovil   := StrToInt(vartostr(vDespJSONDato.Field['viajetimeout'].Field['movil'].Value));
      vDespIdViaje := StrToInt(vartostr(vDespJSONDato.Field['viajetimeout'].Field['idviaje'].Value));
      vDespTipoDato := 5; //Viaje time out
    except

    end;

    try
      vDespMovil := StrToInt(vartostr(vDespJSONDato.Field['historialviajes'].Field['movil'].Value));
      vDespTipoDato := 6; //Historial de Viajes
    except

    end;

    try
      vDespMovil := StrToInt(vartostr(vDespJSONDato.Field['estadoqapqrx'].Field['movil'].Value));
      vDespTipoDato := 7; //Estado del Móvil
    except

    end;

  finally
    vDespJSONDato.Free;
  end;


  //Si no trae algun dato salimos de la funcion
  if vDespTipoDato = 0  then
  begin
    Exit;
  end;


  //Procesamos los datos
  case vDespTipoDato of
  1: begin  //LOGIN
        //Armamos el JSON para enviar como respuesta
        vDespJSONRespuestaLogin  := TlkJSONobject.Create;
        try
          //Chequeamos el login y guardamos el resultado
          vDespRespLogin := LoginInt(vDespDatoRec);

          //Control de Version segun Config
          if vDespConfig_ControlVersion then
          begin
            try
              if StrToFloat(vDespLoginVersion) < vDespConfig_VersionActual then
              begin
                vDespRespLogin := 9;
                vDespMsgError := 'Esta utilizando una version obsoleta. Debe Actualizar la App...';
              end;
            except
              vDespRespLogin := 0;
            end;
          end;

          //Controlamos si hay otro usuario logueado
          {if LoginOtroUsuario(UsuarioMovil(vUsuario)) then
          begin
            vRespLogin := 9;
            vMsgError := 'Existe otro Usuario Logueado en el mismo Movil...';
          end;   }

          //permiso a la aplicacion
          vDespJSONRespuestaLogin.Add('permiso'          , IntToStr(vDespRespLogin) );
          //Config (segundos para el time out)
          vDespJSONRespuestaLogin.Add('segTimeOut'       , IntToStr(vDespConfig_AutoTimeOut) );       //armar la funcion con el setup
          vDespJSONRespuestaLogin.Add('movil'            , IntToStr(UsuarioMovilInt(vDespUsuario)) ); //enviamos el movil del usuario logueado
          vDespJSONRespuestaLogin.Add('intervaloreporte' , IntToStr(vDespConfig_IntervaloReporte) );  //Intervalo en seg para el reporte
          vDespJSONRespuestaLogin.Add('segfinalizarviaje', IntToStr(vDespConfig_FinalizarViaje) );    //Intervalo en seg para el reporte
          vDespJSONRespuestaLogin.Add('msgerror'         , vDespMsgError);                            //Intervalo en seg para el reporte
          //Enviamos el JSOn con la respuesta
          AContext.Connection.IOHandler.WriteLn(TlkJSON.GenerateText(vDespJSONRespuestaLogin));
          Log('->'+vDespUsuario+' '+TlkJSON.GenerateText(vDespJSONRespuestaLogin),1);
        finally
          FreeAndNil(vDespJSONRespuestaLogin);
        end;
     end;
  2: begin //POSICION
        //Guardamos posicion segun Config
        if vDespConfig_GuardarPosicion then
        begin
          if not PosicionInt(vDespDatoRec) then
          begin
            logInt('Error en Guardar Posicion ',0);
          end;
        end;

        vDespAuxS := '';

        //Enviamos Viajes segun Config
        if vDespConfig_EnviarViajes then
        begin
          vDespAuxS := ControlInt(vDespMovil); //VERIFICA SI TIENE VIAJE ASIGNADO
          if Length(vDespAuxS) = 0 then
          begin
            vDespAuxS := ControlQTAInt(vDespMovil); //VERIFICA SI TIENE VIAJE QTA
          end;
        end;

        if Length(vDespAuxS) = 0 then
        begin
          vDespAuxS := '{}';
        end;

        //Enviamos el JSOn con la respuesta
        AContext.Connection.IOHandler.WriteLn(vDespAuxS);

        if vDespAuxS.Length > 2 then
          Log('Viaje -> '+IntToStr(vDespMovil)+' -> '+vDespAuxS,2);
     end;
  3: begin //VIAJE ACEPTADO - QTH FINAL
       //Armamos el JSON para enviar EL QTH FINAL como respuesta
       vDespJSONRespuestaFinal  := TlkJSONobject.Create;
       try
         //vDespIdViaje := StrToInt(vartostr(vDespJSONDato.Field['viajeaceptado'].Field['idviaje'].Value));
         vDespIdViajeEnUso := idviajeenusoInt(vDespIdViaje);
         if vDespIdViajeEnUso > 0 then
         begin
           //vDomicilio := Trim(PendienteCalle(vIdViajeEnUso))+' '+IntToStr(PendienteAltura(vIdViajeEnUso))+' '+PendientePisoDpto(vIdViajeEnUso);
           vDespDomicilio := ArmarDomicilioInt(vDespIdViajeEnUso);
           vDespObservaciones := Trim(PendienteInfoTmpInt(vDespIdViajeEnUso))+' '+trim(PendienteObservacionesInt(vDespIdViajeEnUso));
           vDespViajeLat := Trim(PendienteLatInt(vDespIdViajeEnUso));
           vDespViajeLng := Trim(PendienteLngInt(vDespIdViajeEnUso));
         end
         else
         begin
           vDespDomicilio := 'VIAJE CANCELADO';
           vDespObservaciones := '';
           vDespViajeLat := '';
           vDespViajeLng := '';
         end;

         //DATOS DEL VIAJE
         vDespJSONRespuestaFinal.Add('domicilio'    , vDespDomicilio);
         vDespJSONRespuestaFinal.Add('observaciones', vDespObservaciones);
         vDespJSONRespuestaFinal.Add('lat', vDespViajeLat);
         vDespJSONRespuestaFinal.Add('lng', vDespViajeLng);
         vDespJSONRespuestaFinal.Add('idviaje', IntToStr(vDespIdViaje));

         //Enviamos el JSOn con la respuesta
         AContext.Connection.IOHandler.WriteLn(TlkJSON.GenerateText(vDespJSONRespuestaFinal));
         logInt('Viaje Aceptado -> '+IntToStr(vDespMovil)+' -> '+TlkJSON.GenerateText(vDespJSONRespuestaFinal),2);

         //Marcamos el viaje como aceptado
         DatoViajesInt(True,1, vDespIdViaje);   //MARCAMOS EL VIAJE COMO ACEPTADO
       finally
         FreeAndnil(vDespJSONRespuestaFinal);
       end;
     end;
  4: begin //VIAJE RECHAZADO
       //vDespIdViaje := StrToInt(vartostr(vDespJSONDato.Field['viajerechazado'].Field['idviaje'].Value));
       vDespIdViajeEnUso := idviajeenusoInt(vDespIdViaje);

       //Marcamos el viaje como rechazado
       DatoViajesInt(True,2, vDespIdViaje);   //MARCAMOS EL VIAJE COMO RECHAZADO

       logInt('Viaje Rechazado -> '+IntToStr(vDespMovil) ,2);
     end;
  5: begin //VIAJE TIME OUT
       //vDespIdViaje := StrToInt(vartostr(vDespJSONDato.Field['viajetimeout'].Field['idviaje'].Value));
       vDespIdViajeEnUso := idviajeenusoInt(vDespIdViaje);

       //Marcamos el viaje como timeout
       DatoViajesInt(True,3, vDespIdViaje);   //MARCAMOS EL VIAJE COMO TIME OUT

       logInt('Viaje TimeOut -> '+IntToStr(vDespMovil) ,2);
     end;
  6: begin //HISTORIAL DE VIAJES
       vDespRespS := ViajesInt(vDespMovil);
       //Log('--> '+vRespS);
       AContext.Connection.IOHandler.WriteLn(vDespRespS);
     end;
  7: begin //ESTADO QAP / QRX DELMOVIL
       vDespRespS := ValidarMovilQRXInt(vDespMovil);
       AContext.Connection.IOHandler.WriteLn(vDespRespS)
     end;
  else
    begin
      LogInt('No trajo dato alguno... ',0)
    end;
  end;


  //---------------------------------------------------------------------------

end;
__________________
\_--> NoShY <--_/
Responder Con Cita
  #10  
Antiguo 07-02-2017
Avatar de noshy
noshy noshy is offline
Miembro
 
Registrado: jul 2003
Posts: 139
Poder: 21
noshy Va por buen camino
El codigo de arriba es el codigo ya limpio de todas las pruebas con try / except, por si alguien lo quiere revisar.
__________________
\_--> NoShY <--_/
Responder Con Cita
  #11  
Antiguo 07-02-2017
Reasen Reasen is offline
Miembro
NULL
 
Registrado: dic 2015
Ubicación: Barcelona
Posts: 140
Poder: 9
Reasen Va por buen camino
Prueba con MadExcept lo puedes usar gratis mientras no sea para fines comerciales.
Responder Con Cita
  #12  
Antiguo 07-02-2017
Avatar de Al González
[Al González] Al González is offline
In .pas since 1991
 
Registrado: may 2003
Posts: 5.604
Poder: 29
Al González Es un diamante en brutoAl González Es un diamante en brutoAl González Es un diamante en brutoAl González Es un diamante en bruto
Cita:
Empezado por noshy Ver Mensaje
Son todos iguales los mensajes y una curiosidad, tambien es la misma address 00000000000002C8 en todas las ejecuciones.
Veo que es una aplicación de 64 bits (16 dígitos hexadecimales para las direcciones de memoria). ¿Te es posible compilar y ejecutar la aplicación en 32 bits? ¿Ocurrirá el mismo problema como aplicación de 32 bits?

Por otro lado, un AV con dirección de memoria muy baja es sintomático de intentar usar un objeto Nil; en el desplazamiento 2C8 de la instancia del objeto estaría el campo al que se desea acceder. Si es así, ese desplazamiento pareciera el de un objeto cuya clase posee cierto número de propiedades (particulares más heredadas). Digamos que objeto pequeño no es.

Cita:
Empezado por noshy Ver Mensaje
cada lectura del socket lo realiza en un thread diferente
¿Es posible que al momento de capturar esa imagen haya habido alrededor de 30 hilos activos? (Uno por cada ventana de error). Es casi seguro que esas ventanas de error en cascada surgen de algo que se está ejecutando en segundo plano. ¿Cuál es el código que programaste para esos hilos? Y ¿hay otros hilos para otras tareas?

Saludos.

Al González.
Responder Con Cita
  #13  
Antiguo 08-02-2017
Avatar de noshy
noshy noshy is offline
Miembro
 
Registrado: jul 2003
Posts: 139
Poder: 21
noshy Va por buen camino
Cita:
Empezado por Reasen Ver Mensaje
Prueba con MadExcept lo puedes usar gratis mientras no sea para fines comerciales.

gracias, lo probare!!!
__________________
\_--> NoShY <--_/
Responder Con Cita
  #14  
Antiguo 08-02-2017
Avatar de noshy
noshy noshy is offline
Miembro
 
Registrado: jul 2003
Posts: 139
Poder: 21
noshy Va por buen camino
Cita:
Empezado por Al González Ver Mensaje
Veo que es una aplicación de 64 bits (16 dígitos hexadecimales para las direcciones de memoria). ¿Te es posible compilar y ejecutar la aplicación en 32 bits? ¿Ocurrirá el mismo problema como aplicación de 32 bits?

Por otro lado, un AV con dirección de memoria muy baja es sintomático de intentar usar un objeto Nil; en el desplazamiento 2C8 de la instancia del objeto estaría el campo al que se desea acceder. Si es así, ese desplazamiento pareciera el de un objeto cuya clase posee cierto número de propiedades (particulares más heredadas). Digamos que objeto pequeño no es.


¿Es posible que al momento de capturar esa imagen haya habido alrededor de 30 hilos activos? (Uno por cada ventana de error). Es casi seguro que esas ventanas de error en cascada surgen de algo que se está ejecutando en segundo plano. ¿Cuál es el código que programaste para esos hilos? Y ¿hay otros hilos para otras tareas?

Saludos.

Al González.
Hola, si es una app de 64 bits, si lo compilo en 32 me pasa lo mismo no hay mejora.

Con respecto a que es un obejto = nil, yo pense lo mismo,pero seguramente no es un objeto que yo creo en el código, ya que si fuera asi me lo tomaria alguna exception, y no lo toma inclusive me lo deberia tomar eurekalog, o me daria error en algunos hilos y no en todos.

Para que te des idea del porque la cantidad de dialogos de error, la app funciona perfectamente hasta que en un momento todos los hilos comienzan a generar el mismo error, es como que en cada paquete que recibe se genera el error, que es lo que me llama la atencion ya que si fuera un objeto mal cerrado o algun paquete recibido con error no pasaria en todas las conexiones, o sea que lo que ves que son 30 dialogos con error en realidad son muchos mas porque sobre el margen inferior derecho estan superpuestos y es imposibles cerrarlos a mano ya que tengo un aproximado de 7 conexiones por segundo, imaginate la cantidad de errores que larga en ese momento.

Editado: Elcodigo del thread es el que publique arriba, lo publique en dos partes porque no entraba todo en un solo mensaje, ese es el procedimiento del evento OnExecute delcomponente Indy TCPServer.
La primer parte son las funciones declaradas dentro del pocedimiento para que las cargue en cada thread y la segunda parte esel procedimiento en si.
__________________
\_--> NoShY <--_/

Última edición por noshy fecha: 08-02-2017 a las 01:36:05.
Responder Con Cita
  #15  
Antiguo 08-02-2017
Avatar de Al González
[Al González] Al González is offline
In .pas since 1991
 
Registrado: may 2003
Posts: 5.604
Poder: 29
Al González Es un diamante en brutoAl González Es un diamante en brutoAl González Es un diamante en brutoAl González Es un diamante en bruto
Cita:
Empezado por noshy Ver Mensaje
El código del thread es el que publique arriba, lo publique en dos partes [...] es el procedimiento del evento OnExecute delcomponente Indy TCPServer. La primer parte son las funciones declaradas dentro del pocedimiento para que las cargue en cada thread y la segunda parte esel procedimiento en si.
¿Qué uso tiene ese componente y qué propósito tiene ese evento en particular? (Casi no he usado los Indy).

¿El código se ejecuta con sincronía/semáforos? Esto lo pregunto porque ahí veo referencias a elementos de la interfaz de usuario, que si no controlas la sincronía tendrás problemas de colisión.

¿Te es viable elaborar una aplicación de prueba donde te asegures de llamar tú mismo a ese manejador de eventos desde numerosos hilos a fin de provocar el error de forma controlada en tu computadora de desarrollo?

¿Hay forma de instalar el entorno de Delphi en la computadora donde actualmente ocurre el problema y ejecutar ahí la aplicación con el depurador activo, a fin de detectar con el mismo IDE el código fuente donde ocurre la excepción inicial?

Por ahora te recomiendo que encierres el código fuente de cada una de esas rutinas en un Try-Except similar a este:
Código Delphi [-]
  Function ValidarCosa1 :Boolean;
  Begin
    Try
      // Código actual...
    Except
      On E :Exception Do
        ShowMessage ('Excepción en ValidarCosa1: ' + E.Message);  // <--- Y/o "log" a disco
    End;
  End;
A fin de encontrar cuál de todas ellas es la que genera la excepción.
Responder Con Cita
  #16  
Antiguo 08-02-2017
[maeyanes] maeyanes is offline
Capo de los Capos
 
Registrado: may 2003
Ubicación: Campeche, México
Posts: 2.732
Poder: 23
maeyanes Va por buen camino
Hola...

¿Has intentado buscar la dirección que indica el mensaje de error? Se supone que la dirección 988441 contiene el código que genera el error. Intenta buscar esa dirección dentro del IDE de Delphi. En el menú Search - Go to Address ingresa esa dirección a ver a que parte de tu código te lleva (la aplicación debe estar ejecutándose y pausada).

También podrías intentar algo de lo aquí indicado: How do I debug an Access violation in the field?


Saludos...
__________________
Lee la Guía de Estilo antes que cualquier cosa. - Twitter
Responder Con Cita
  #17  
Antiguo 08-02-2017
Avatar de AgustinOrtu
[AgustinOrtu] AgustinOrtu is offline
Miembro Premium
NULL
 
Registrado: ago 2013
Ubicación: Argentina
Posts: 1.858
Poder: 15
AgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en bruto
Podes usar el depurador remoto sin necesidad de instalar todo Delphi. Busca en la documentación PAServer
Responder Con Cita
  #18  
Antiguo 06-03-2017
Avatar de noshy
noshy noshy is offline
Miembro
 
Registrado: jul 2003
Posts: 139
Poder: 21
noshy Va por buen camino
Hola a todos, disculpen la demora en responder pero estuve de vacaciones.

El tema ya lo solucione, realice varios cambios asi que no se bien cual de todos lo solucionó o si fue un conjunto de todo.

En primer lugar en vez de compilarlo en XE5 lo migre a 10.1 Berlin, el cambio lo realice porque en XE5 utilizaba la libreria uLkJSON.pas y en Berlin tiene su propia libreria JSON, el error seguia apareciendo pero con menos frecuencia.

Luego, yo tenia creada una conexion con la data base en tiempo de diseño y los query que creaba en los hilos del socket los ligaba a ella, el cambio que realice fue crear una nueva conexion para cada hilo que se crea en el socket, obvio son mas recursos pero mejoro la cosa.

Y el tercer cambio fue no utilizar ningún componente visual como lo estaba haciendo, utilizaba un memo para ir mostrando el log (no creo que haya sido este el problema).

Con todos estos cambios el error desapareció.

Gracias a todos por su ayuda.

Saludos
__________________
\_--> NoShY <--_/
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
no me detecta teclado numero Rofocale Varios 4 20-06-2011 23:00:14
BDS 2006 no detecta el IIS 7 en Win Vista ozrics Windows 0 17-06-2007 04:19:45
Software k detecta hardware Mrcl Debates 2 03-01-2007 22:07:58
la función SetSchemaInfo no detecta los índices amezeta32 Conexión con bases de datos 1 29-08-2006 22:51:53
¿Cua es el error que me detecta???? gandalf_27 C++ Builder 1 27-04-2006 19:57:44


La franja horaria es GMT +2. Ahora son las 16:19:51.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi