Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange 0x0eedfade exception in Delphi multi thread program

I have strange problem with my multi threaded server. It is Windows service and works similar to FTP server managing socket connection to many clients. It was created using Delphi 2006 (Turbo Delphi) and works well on most machines. Unfortunately on some machines it sometimes crashes without any trace from itself (exception should be saved to log, but are not). Sometimes system shows MessageBox (it is not MessageBox from service, but I think it is system MessageBox), but most often I see such information in System EventLog:

Application popup: ht_switch.exe - Application Error : The exception unknown software exception (0x0eedfade) occurred in the application at location 0x77e4bef7.

In Application EventLog I can see:

Faulting application ht_switch.exe, version 1.2.0.2, faulting module kernel32.dll, version 5.2.3790.5069, fault address 0x0000bef7.

Sometimes such entries are in Application or System EventLog, but nothing happens -- my server works as usually, but sometimes is simply disappears. Then Service Manager reports in EventlLog that my service unexpectedly stopped.

I see no "common" scenario to such problem. It appears on some WinXP, Win2003 and Win2008. All test machines have all MS patches applied.

I have read answers to: 0x0eedfade kernelbase.dll faulting module in d7 windows service but I do not use Dialog unit.

What can I do to repair it? How to trace such 0x0eedfade exception?

EDIT

I tested for some days my server with both EurekaLog and madExcept.

EurekaLog:

Server works without problem. No exception is reported in EventLog. No exception is reported in %AppData%\EurekaLab s.a.s\EurekaLog\Bug Reports\ (there should be directory for my program, but it was not created -- I don't know if it should be created or if it is an EurekaLog error).

EurekaLog7 have problem with setting "Application Type" to Windows Service. It is known problem and authors works on it. My service compiled with it works on WinXP but was not able to work on Win2003. It simply do not start.

madExcept:

Server worked for 4 hours and crashed. I have caught this exception in my thread:

EAccessViolation: Access violation at address 7C90100B in module 'ntdll.dll'. Read of address 00000018!!!

I haven't noticed any madExcept report on this exception. After this exception one thread was lost with socket in CLOSE_WAIT state (other side closed connection). Then I restarted my service and after next few hours it worked without problem.

disabled EurekaLog and madExcept:

After 10-30 minutes I see MessageBox with error. But 0x0eedfade error is cryptic and do not show me any hint on source of the problem. It is also very strange because after displaying such message service works without problem (most of the time).

Summary od exception interceptors:

EurekaLog and madExcept are probably good at exceptions raised by Delphi but it seems that change behavior of my service and error magically disappeared or they report exception to place I cannot find.

EDIT: Problem solved

After some debugging that lead me to nowhere (Call Stack with very strange places) I resigned from it and started to inspect lastly commited changes. One change was string operation where string (AnsiString) can be of length 64 or 128 (some kind of bit mask). I set 70th character of string that was earlier allocated with SetLength(buffer, 64). That was the problem. I think I would save time by enabling range checking.

like image 444
Michał Niklas Avatar asked May 17 '13 06:05

Michał Niklas


1 Answers

How to trace such 0x0eedfade exception?

This is the code for a Delphi exception. Clearly you are raising a Delphi exception that is not being handled and that is bringing your process down.

You should add madExcept, EurekaLog, JCLDebug or similar to your process. These tools will produce diagnostics reports when your process fails. The most useful part of those reports will be the stack trace at the point of failure. You should be able then to work out where the failure occurs, at the very least, and this usually is enough to work out what is wrong with your code.

like image 78
David Heffernan Avatar answered Sep 22 '22 11:09

David Heffernan