title: Strange 0x0eedfade exception in Delphi multi thread program
body: <p>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:</p>
  
  <pre><code>Application popup: ht_switch.exe - Application Error : The exception unknown software exception (0x0eedfade) occurred in the application at location 0x77e4bef7.
  </code></pre>
  
  <p>In Application EventLog I can see:</p>
  
  <pre><code>Faulting application ht_switch.exe, version 1.2.0.2, faulting module kernel32.dll, version 5.2.3790.5069, fault address 0x0000bef7.
  </code></pre>
  
  <p>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.</p>
  
  <p>I see no "common" scenario to such problem. It appears on some WinXP, Win2003 and Win2008. All test machines have all MS patches applied.</p>
  
  <p>I have read answers to: <a href="https://stackoverflow.com/questions/8148853/0x0eedfade-kernelbase-dll-faulting-module-in-d7-windows-service">0x0eedfade kernelbase.dll faulting module in d7 windows service</a> but I do not use <code>Dialog</code> unit.</p>
  
  <p>What can I do to repair it? How to trace such <code>0x0eedfade</code> exception?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tested for some days my server with both EurekaLog and madExcept.</p>
  
  <p><em>EurekaLog</em>:</p>
  
  <p>Server works without problem. No exception is reported in EventLog. No exception is reported in <code>%AppData%\EurekaLab s.a.s\EurekaLog\Bug Reports\</code> (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).</p>
  
  <p>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.</p>
  
  <p><em>madExcept</em>:</p>
  
  <p>Server worked for 4 hours and crashed. I have caught this exception in my thread:</p>
  
  <pre><code>EAccessViolation: Access violation at address 7C90100B in module 'ntdll.dll'. Read of address 00000018!!!
  </code></pre>
  
  <p>I haven't noticed any madExcept report on this exception. After this exception one thread was lost with socket in <code>CLOSE_WAIT</code> state (other side closed connection). Then I restarted my service and after next few hours it worked without problem.</p>
  
  <p><em>disabled EurekaLog and madExcept</em>:</p>
  
  <p>After 10-30 minutes I see MessageBox with error. But <code>0x0eedfade</code> 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).</p>
  
  <p><strong>Summary od exception interceptors</strong>:</p>
  
  <p>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.</p>
  
  <p><strong>EDIT: Problem solved</strong></p>
  
  <p>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 <code>SetLength(buffer, 64)</code>. That was the problem. I think I would save time by enabling range checking.</p>