WCF service restarting?

Discussion in 'General troubleshooting' started by edhalsim, Apr 28, 2010.

  1. Hi,

    I'm seeing some odd behavior from my WCF service. It seems to work for a short while (few requests), but then I start getting null data returned where I expect there to be valid data. I'm theorizing that the web service is restarting for some reason, thus clearing out data that I'm keeping in memory. Note that I have the service set up as:
    [ServiceBehavior( InstanceContextMode = InstanceContextMode.Single )]
    so that I only get one instance.

    Any ideas as to what may be happening? Thanks for your time.
    - Ed.

    One other thing; the web service does at times create a background thread that runs for a short while, then quits. Don't know if that's related or not. I'm not seeing any issues on my development environment.
     
  2. Ray

    Ray

    If your web application is restarting then it is probably reaching these thresholds.

    1) More than 20 minutes of idle time (no http request in 20 minutes)
    2) The application uses more than 100 MB memory
    3) The application uses more than 75% of CPU time

    The server is setup to monitor application pools and it has a condition where if an application pool reaches any one of these thresholds it will recycle the application pool.

    You may want to try running your application on your development box and monitor the task manager if it reaches any of these thresholds.
     
  3. Thanks for the info. I do have some memory issues that I need to address.
     
  4. Don't we all.

    ;)
     
  5. Well the mystery continues. I ran another test today on a more memory efficient version of my service and I show (via Process.GetCurrentProcess().PrivateMemorySize64) that my service never exceeded 90 MB and wasn't idle. I can't say for CPU %. I verified that the process ID did change.

    Is there a way to see exactly why the process (SilverRails.Web) was restarted? Is there a log? This happened today at around 3:06 PM your time.

    Thanks for your help!
    - Ed.
     
  6. Ray

    Ray

    The server will not log that type of error. Open a ticket to our support and they maybe able to check the event log and verified if your applications are being recycled due to these conditions.

    They should be able to give you a date and time when it was recycled and you can bounce it off your SmarterStats to find out what web pages where being called around those time frame. Then you can narrow down what method, class, or assembly is causing the recycling.
     
  7. Still no luck. I'm wondering if there's also a limit on the number of background threads that the process can create (I'm not creating a whole bunch, just a couple). There were event log messages that said things like:

    A process serving application pool 'customerPool_7280' suffered a fatal communication error with the Windows Process Activation Service.

    Searching for the error indicates something in my code is causing it to crash, but it runs fine in my dev. environment. I also added an HttpModule to try to capture any unhandled exceptions, but it too fails to trap anything unusual.
     
  8. Ray

    Ray

    What exactly is your web application doing? Is it making an outbound call or is it waiting for a incoming call from a external source?
     
  9. Neither. It's a multi-player game where the computer is taking a turn. The web service call from the client needs to return so each player can take their turn. I launch a background thread for the computer to take its turn. I added some logging to a text file, but I'm not seeing anything for when the new thread starts, so either the thread isn't starting or there's something wrong with how I'm doing the logging.
     
  10. Ray

    Ray

    Can you call the web service directly on your site without it giving any errors?
     

Share This Page