Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Access violation in SA running as a service
#1
Hi,
I've developped an application as SA. When I run the exe and open a browser (either local or from another device in the network) and look for (i.e.) https://(my_ip):8080/$/start, my initial form appears. 
Then, I try to use my application from a Windows service. if I run, in same folder, a version of exe compiled with flag set to False in this way:
myapp /install
I can see the message "service installed successfully", and I can see service in Services Panel. I start the service and, when I open my browser and look for same address, I obtain following error:


Application Error
An unhandled application error has occured within eMomoTaller

Error message: Access violation at address 012725E3 in module 'eMomoTaller.exe'. Read of address 00000008

Depending on the error condition, it might be possible to restart the application.


In order to restart the application, please click the link below:

Click here to restart eMomoTaller

Please note that depending on the actual exception that occured, restarting the application might not be possible. If this is the case, please report the error message to the administrator.


Error details:
------------------------------------------------------------------------------------------------------------------------
Exception message : Access violation at address 012725E3 in module 'eMomoTaller.exe'. Read of address 00000008
Depending on the error condition, it might be possible to restart the application.
Exception class : EAccessViolation
Exception address : 012725E3
Exception Time : 2025-06-20 08:54:32.467
------------------------------------------------------------------------------------------------------------------------
Client IP address : 127.0.0.1
Request PathInfo : /
Request Method : POST
Request User Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0
Cookies Count : 0
------------------------------------------------------------------------------------------------------------------------
(006B15E3){eMomoTaller.exe} [012725E3] HotLog.THotLog.Add (Line 1194, "HotLog.pas" + 1) + $5
(00417831){eMomoTaller.exe} [00FD8831] IWJclDebug.TJclStackBaseList.Create (Line 4478, "IWJclDebug.pas" + 3) + $0
(000060F0){eMomoTaller.exe} [00BC70F0] System.@GetMem$qqri (Line 4962, "System.pas" + 20) + $0
(0000B28A){eMomoTaller.exe} [00BCC28A] System.@NewUnicodeString$qqri (Line 26043, "System.pas" + 10) + $0
(0000C736){eMomoTaller.exe} [00BCD736] System.@UStrCatN$qqrv (Line 31713, "System.pas" + 81) + $0
(008ADE75){eMomoTaller.exe} [0146EE75] Rutinas_Aux.MensajeLog$qqrip14Hotlog.THotLog20System.UnicodeStringt3t3 (Line 1668, "Rutinas_Aux.pas" + 3) + $30
(008AE035){eMomoTaller.exe} [0146F035] Rutinas_Aux.MensajeLog$qqri20System.UnicodeStringt2t2 (Line 1683, "Rutinas_Aux.pas" + 1) + $14
(00C96649){eMomoTaller.exe} [01857649] UserSessionUnit.TIWUserSession.SetupSession (Line 187, "UserSessionUnit.pas" + 2) + $1A
(00C99118){eMomoTaller.exe} [0185A118] ServerController.TIWServerController.IWServerControllerBaseNewSession (Line 63, "ServerController.pas" + 2) + $5
(0038A613){eMomoTaller.exe} [00F4B613] IWServerControllerBase.TIWServerControllerBase.DoNewSession (Line 1297, "IWServerControllerBase.pas" + 2) + $8
(004317A8){eMomoTaller.exe} [00FF27A8] IWServerSession.TIWServerSession.GetSession$qqrx20System.UnicodeString (Line 1256, "IWServerSession.pas" + 70) + $10
(00430465){eMomoTaller.exe} [00FF1465] IWServerSession.TIWServerSession.ExecuteSession$qqrx20System.UnicodeString (Line 888, "IWServerSession.pas" + 40) + $6
(0041D633){eMomoTaller.exe} [00FDE633] IWServer.TIWServer.ExecuteUrl (Line 750, "IWServer.pas" + 99) + $6
(0041DB6B){eMomoTaller.exe} [00FDEB6B] IWServer.TIWServer.Execute (Line 825, "IWServer.pas" + 19) + $9
(0042D173){eMomoTaller.exe} [00FEE173] IWServerSession.HttpExecute$qqrpuci (Line 143, "IWServerSession.pas" + 2) + $3
(004D4B86){eMomoTaller.exe} [01095B86] IW.Server.HTTPIndy.Server.Httpindy.THTTPServerIndy.DoCommandGet (Line 370, "IW.Server.HTTPIndy.pas" + 36) + $17
(0046D19C){eMomoTaller.exe} [0102E19C] InCustomHTTPServer.TInCustomHTTPServer.DoExecute (Line 1518, "InCustomHTTPServer.pas" + 190) + $F
(00457C73){eMomoTaller.exe} [01018C73] InContext.TInContext.Run (Line 185, "InContext.pas" + 2) + $7
(00456C5A){eMomoTaller.exe} [01017C5A] InTask.TInTask.DoRun (Line 136, "InTask.pas" + 0) + $2
(0045B1EE){eMomoTaller.exe} [0101C1EE] InThread.TInThreadWithTask.Run (Line 754, "InThread.pas" + 1) + $3
(0045AAB9){eMomoTaller.exe} [0101BAB9] InThread.TInThread.Execute (Line 439, "InThread.pas" + 50) + $5
(000E246D){eMomoTaller.exe} [00CA346D] System.Classes.ThreadProc$qqrxp22System.Classes.TThread (Line 16396, "System.Classes.pas" + 18) + $5
(0000B1D8){eMomoTaller.exe} [00BCC1D8] System.ThreadWrapper$qqspv (Line 25814, "System.pas" + 45) + $0


Any idea about how to fix this?

Best regards,
          Venancio Lasquibar
Reply
#2
(06-20-2025, 06:58 AM)v.lasquibar@telefonica.net Wrote: Error message: Access violation at address 012725E3 in module 'eMomoTaller.exe'. Read of address 00000008

An AV near address 0 usually means a nil pointer is being accessed.

(06-20-2025, 06:58 AM)v.lasquibar@telefonica.net Wrote: (006B15E3){eMomoTaller.exe} [012725E3] HotLog.THotLog.Add (Line 1194, "HotLog.pas" + 1) + $5
...
Rutinas_Aux.MensajeLog$qqrip14Hotlog.THotLog20System.UnicodeStringt3t3 (Line 1668, "Rutinas_Aux.pas" + 3) + $30
(008AE035){eMomoTaller.exe} [0146F035] Rutinas_Aux.MensajeLog$qqri20System.UnicodeStringt2t2 (Line 1683, "Rutinas_Aux.pas" + 1) + $14
(00C96649){eMomoTaller.exe} [01857649] UserSessionUnit.TIWUserSession.SetupSession (Line 187, "UserSessionUnit.pas" + 2) + $1A

The trace log is saying that the AV is occurring at address 012725E3, which is the call to HotLog.THotLog.Add(). What is THotLog? Is it something attached to MensajeLog()?

Looks to me like TIWUserSession.SetupSession() is trying to log something, and is failing because HotLog is not available. Perhaps there is a THotLog object pointer that is nil when it shouldn't be and the code is not handling that possibility.

Reply
#3
(06-20-2025, 04:19 PM)rlebeau Wrote:
(06-20-2025, 06:58 AM)v.lasquibar@telefonica.net Wrote: Error message: Access violation at address 012725E3 in module 'eMomoTaller.exe'. Read of address 00000008

An AV near address 0 usually means a nil pointer is being accessed.

(06-20-2025, 06:58 AM)v.lasquibar@telefonica.net Wrote: (006B15E3){eMomoTaller.exe} [012725E3] HotLog.THotLog.Add (Line 1194, "HotLog.pas" + 1) + $5
...
Rutinas_Aux.MensajeLog$qqrip14Hotlog.THotLog20System.UnicodeStringt3t3 (Line 1668, "Rutinas_Aux.pas" + 3) + $30
(008AE035){eMomoTaller.exe} [0146F035] Rutinas_Aux.MensajeLog$qqri20System.UnicodeStringt2t2 (Line 1683, "Rutinas_Aux.pas" + 1) + $14
(00C96649){eMomoTaller.exe} [01857649] UserSessionUnit.TIWUserSession.SetupSession (Line 187, "UserSessionUnit.pas" + 2) + $1A

The trace log is saying that the AV is occurring at address 012725E3, which is the call to HotLog.THotLog.Add().  What is THotLog?  Is it something attached to MensajeLog()?

Looks to me like TIWUserSession.SetupSession() is trying to log something, and is failing because HotLog is not available.  Perhaps there is a THotLog object pointer that is nil when it shouldn't be and the code is not handling that possibility.

Hi rlebeau,
First, thanks for your answer. HotLog is a 3rd party component I use to record log and trace messages. I know that the error indicates that HotLog is nil. I create the object in UserSession.IWUserSessionBaseCreate, and i use it next in a call to "mensajeLog". But my question is: why if I create the EXE with IWStart.Execute(True) the application starts normally and the main form is shown, whilst when I create the EXE with IWStart.Execute(False) this Access Violation appears. 
Best regards,

      Venancio Lasquibar
Reply
#4
Hi,
Finally I found the solution. Root cause was the Application Working directory: when running in mode Service, must be changed using this code:

procedure TIWServerController.IWServerControllerBaseCreate(Sender: TObject);
var
Path: array[0..MAX_PATH] of Char;
ExtractedPath: string;
I: Integer;
begin
GetModuleFileName(HInstance, Path, SizeOf(Path));
ExtractedPath := string(Path);
I := LastDelimiter('\', ExtractedPath);
if I > 0 then
ExtractedPath := Copy(ExtractedPath, 1, I - 1);

SetCurrentDir(ExtractedPath);

Pool.Active := True;

end;

With this change, everything works as expected.

KR,
Venancio Lasquibar
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)