Windows Service crashing once a day RRS feed

  • Question

  •  We have a Windows Service developed in VB.NET and using .Net 2.0 framework running on Windows server 2003 sp2.
    Basically, our service uses serial port objects, some IO logging to text file and of course database calls. We also have a ping logic that pings like about 50 machines in a loop
    within a timer. The timer that I use is of System.Timers.Timer type.

    This service crashes about once a day. We get the following description for ".Net 2.0 Runtime error,event ID 1000" on the Event Viewer:
    Faulting application readerservice.exe, version, stamp 49de72c5, faulting module msvcr80.dll, version 8.0.50727.1433, stamp 471eb5ae, debug? 0, fault address 0x000150d8.

     We logged the unhandled exception and this is what we found just before the application crashed.

    System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading._TimerCallback.PerformTimerCallback(Object state)

    The application is being run on a VMWare Server.

    Any help on this would be deeply appreciated.

    • Edited by Gabe J Monday, April 27, 2009 4:57 PM
    Friday, April 24, 2009 2:47 PM

All replies

  • It's very difficult to tell what could be the problem without the source code. Check to ensure your timer is not being disposed or GC'ed.

    Friday, April 24, 2009 3:27 PM
  • There is no sign of any of your code running on the call stack. Looks to me like the CLR is crashing.  There have been a lot of bug fixes since .NET 2.0, I'd recommend you start by deploying .NET 3.5 SP1 on that machine.

    Hans Passant.
    Friday, April 24, 2009 3:40 PM
  • It is difficult to answer without seeing the code beforehand.
    It is likely that you are using some portion of memory shared between threads.
    What is common to use a class monitor when waiting for replies a serial port.
    It's just an idea.
    I hope to help.

    Friday, April 24, 2009 3:41 PM