Why does an EA stop responding?

 

I have written a simple EA. On init, it opens a file handle. On every tick, it writes to a file the current ask and bid price and flushes the file handle. On deinit, it logs a "deinit" statement and closes the file handle.

I have observed that sooner or later the EA stops running. No lines are written to the log file anymore and the deinit statement does not exist in the log file. MetaTrader is still receiving data and the chart the EA is attached to is still changing values, but the EA does not log anymore. I still have an internet connection and have no reason to believe it was ever interrupted (I have a very reliable DSL line).

-The size of the file appears random. Somtimes the EA stops after a few hours and the file is less than a meg, sometimes the EA stops after a day and the file is a few megs.

-The time the EA stops appears random. Here are some of the server times it has stopped with USDJYP:
11-16 14:1:23
11-17 20:59:23
11-20 5:35:6
11-20 8:13:29
11-21 19:51:47

-I have observed this behavior with USDJYP, EURUSD, and GBPUSD.

I'm not sure where to go from here. My client requires an EA that can reliably run and stay running. Anybody have any help at all with this?

Thank you,
jskillings