I've done a number of .NET geoprocessing tools for ArcGIS 10.1 that get published as geoprocessing services on ArcGIS Server.
Lately we've seen behavior that makes me question something I thought I long understood - the role of a tool's "FunctionFactory" (IGPFunctionFactory).
- the role of the factory was to create and hand out the Functions (IGPFunction) or their Names (IName/IGPName/GPFunctionNameClass) (in GetFunction(), GetFunctionName(), GetFunctionNames())
- that one instance of the Factory gets created per process (ArcMap- desktop), (SOC - server), automatically by ArcGIS at process start, by virtue of the Factory being registered in its component category
- so that you could rely on it to be in place before any instance of a tool/service could be used.
And so one thing I use the Factory for is one-time initialization (in a static ctor of the Factory) of services that are shared in common by all the tools exposed by the factory, such as configuration and logging.
Lately, promoting to a new environment, in a 2-machine cluster, we've seen cases (rare - one in a few dozen requests) where requests to a service are handled, but factory-based initialization has not yet occurred - so though the service is running, it is not yet configured (and so the request fails to be handled successfully), and neither is the log, so the error doesn't get logged (except by ArcGIS Server's own logging).
Any thoughts on what I'm missing?