Select to view content in your preferred language

REST service gone idle throws an exception when first accessed

4098
12
08-10-2010 12:59 PM
StephenDavis
Emerging Contributor
When accessing a map service REST endpoint with any significant number of layers (at least 30 layers or so) that has gone "idle", an error is thrown.  So, if I go to http://servername/arcgis/rest/services/servicename/MapServer and that service hasn't been accessed in a while, the screen will display

----Service 'servicename' of type 'MapServer' does not exist or is inaccessible.

If I wait a few seconds, I can go back to the URL and it will work fine from that point forward.  If it has gone idle, why does it not wake it up and then continue on rather than throwing an exception?  Is there any way to avoid this behavior without setting the time limit at which a map service goes idle really high?  We would still like them to go idle but have them wake up normally and be accessible from the first time it is accessed after being idle.

When this happens, we get the following errors in the log:

Server Context creation failed on machine servername.
Container  process 12624 has crashed on machine servername.

This happens consistently every time and only happens the first time it is accessed each day.  After that it starts up fine and is available.

Thanks!
Stephen
0 Kudos
12 Replies
JenniferNery
Esri Regular Contributor
Hi Stephen,

When you access the URL via browser for the first time after it has been idle, do you get the same error as when use SL/WPF API?

If not, you can listen to the layer's InitalizedFailed event. This is probably where the exception is thrown and you can do what you need to do inside this event handler to maybe try to Initialize again.

It might also be a good idea to look at the web requests/responses using Fiddler so we can narrow down where it is failing based on the sequence of events.

Jennifer
0 Kudos
StephenDavis
Emerging Contributor
Yes we get the error when accessing it through SL as well.  I opened fiddler and tried it out, and this is what is being returned from the server:

HTTP/1.1 404 Not Found

So ArcGIS Server is choosing to not even respond.

Typically we do a SOAP call to the service before SL starts trying to load the map so we can get some values we need to initialize the application.  It occurs with a SOAP or a REST call however.  I tried putting it in a loop where if it fails it tries again and the calls are being made so fast that sometimes it will fail 10 times in a row before getting a success, however that is not an appropriate solution for us as it is not finite.  We would really like some way to prevent this error from occurring other than making the service not go idle.

Thanks!
Stephen
0 Kudos
agauch
by
Occasional Contributor
I have the same error when accessing REST endpoints the first time after a long time (several hours).
I have this exception on every ArcGIS Server installation that I use (about 5).

I think that this problem only occurs when the data are on an ArcSDE geodatabase. The map services based on a file geodatabase are not throwing this error.

Is there something to configure on ArcSDE for these map services continue working after gone idle?

Thanks.
0 Kudos
dotMorten_esri
Esri Notable Contributor
I would suggest you ask in the REST Server forums where there are a lot more people who knows the server:
http://forums.arcgis.com/forums/11-ArcGIS-Server-REST-API
0 Kudos
KeithGanzenmuller
Frequent Contributor
Did anyone get an answer to this?
I have the same issue if I open my SL page first thing in the morning or after a long idle time. I set the InitializationFailed event to try to initialize the service but to no avail, maybe not enough time between initial failure and the second attempt. I also went to the service properties in ArcCatalog and set it to check the connection every 10 minutes, still the same.
I checked over in the REST forum and didn't see it addressed there.
0 Kudos
GiosiaPoma
Regular Contributor
Hi,
I have the same problem. Every day the firts 3 query on the table are with error 500. The fourth is ok.
In the arcgis server I can see this error: Server Context creation failed for the service that I've tried to query.

Anyone have an idea?

thanks
0 Kudos
ErikEngstrom
Frequent Contributor
I have a VB script that calls the rest endpoints of my production services first thing in the morning. I put the script into a Scheduled Task to be called in the morning and again every 30 minutes. It works perfectly.

If you'd like it, I can supply the code here. I got it from somewhere in the ESRI support forum land, so it may have already been linked here.
0 Kudos
GiosiaPoma
Regular Contributor
hi!

My experience about some error of first access are solved by checking the option: "Periodically check and repair data connections for idle instances" with 30 minutes.

What I have found is that my db administrator stop the database for backup issue and after that the service don't work. With this option all is ok.

Note: the service is for editing data. Service with read only data are oks.
0 Kudos