Forum > Lazarus Extra Components
Daemon app crashes on Windows after some time regarding ntdll.dll
(1/1)
antispam88:
Hi,
we have two different services for windows 10/2019 x64. They are build with the lazdaemon package.
It is working as expected for few hours up to several days. Then the service crashes with following event view entry:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Faulting application name: aservice.exe, version: 4.4.0.7, time stamp: 0x00000000Faulting module name: ntdll.dll, version: 10.0.14393.3986, time stamp: 0x5f77fd0dException code: 0xc0000374Fault offset: 0x00000000000f6fb3Faulting process id: 0x10a4Faulting application start time: 0x01d6d7a4fd4d31eaFaulting application path: C:\aservice\bin\aservice.exeFaulting module path: C:\Windows\SYSTEM32\ntdll.dllReport Id: a5684795-7a9d-4cc4-b4ac-39136047d481Faulting package full name: Faulting package-relative application ID:
We have created our service like the cleandirs example.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- TAService = class(TDaemon) procedure DataModuleCreate(Sender: TObject); procedure DataModuleDestroy(Sender: TObject); procedure DataModuleShutDown(Sender: TCustomDaemon); procedure DataModuleStart(Sender: TCustomDaemon; var OK: boolean); procedure DataModuleStop(Sender: TCustomDaemon; var OK: boolean); private _working_thread: TWorkingThead; end;
We tried to cover every line of code for exception handling. And we also using the Application.OnException event to log the error without success.
Has anyone made some experience with uncaught expections in services? We have already tried to change the release settings to debug without a result.
Best regards,
antispam88
Lazarus: 3.0.8
FPC: 3.0.4
X86x_64-wind64-win32/win64
Windows 10 prof. 64x
ASBzone:
According to the following URL, the error message you are receiving is indicative of a heap corruption issue:
https://social.technet.microsoft.com/Forums/windows/en-US/578396fd-29c0-4dd3-b002-5e2e8df1b398/exception-code-0xc0000374?forum=w7itprogeneral
You might want to run with heaptrc and see about tracking this issue down that way.
https://www.freepascal.org/docs-html/rtl/heaptrc/usage.html
440bx:
--- Quote from: antispam88 on December 22, 2020, 02:43:30 pm ---Exception code: 0xc0000374
--- End quote ---
As ASBzone pointed out, that is the NTSTATUS indicating that a heap has been corrupted. If interested, that status and many others are documented in https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55
Errors of that nature are commonly caused by a buffer overrun. What makes them difficult to find is that it is common for the overrun to end up causing problems much after it has occurred. Another common source of problems is allocating a buffer and not initializing it, potentially resulting in using random data later as a value that can lead to the corruption of a different memory block (e.g, data used as an offset into other data.)
That's the first "profilactic" step, ensure all allocated memory blocks are properly initialized before being used (usually to binary zeroes), that can be helpful in figuring out where the problem takes place.
Navigation
[0] Message Index