Why do my applications fail using multiple dispatchers?

Make sure that each dispatcher has its own configuration file and its own session directory.

Examine the fastcgidispatch.log of your application. If you see error messages like those shown, it indicates that the dispatcher was running but has been stopped as another dispatcher is starting with the same configuration for the session directories.
10:59:49.791098 890.969044 [session.c:794] 10089 2 - "Session" The session owner has changed
10:59:49.791468 890.969415 [session_timeout.c:491] 10089 2 - "Session timeout" Session owner has changed, exiting
To resolve, review your xcf file configuration; specially for session (SESSION_DIRECTORY) and log directories. When configuring several dispatchers on the same host, make sure that each dispatcher has its own configuration file (as a copy of main GAS as.xcf) with different configuration settings for the following resources:
  • SESSION_DIRECTORY (res.path.session)
  • LOG directory (res.log.output.path)
  • TEMPORARY_DIRECTORY (res.path.tmp)
Create separate session directories for each dispatcher on disk. Then change the default resources in the configuration file to use these directories. For example change:
<RESOURCE Id="res.path.session" Source="INTERNAL">$(res.appdata.path)/session</RESOURCE>

<SESSION_DIRECTORY>$(res.path.session)</SESSION_DIRECTORY>
To:
<RESOURCE Id="res.path.session" Source="INTERNAL">$(res.appdata.path)/session_dispatcher_1</RESOURCE>

<SESSION_DIRECTORY>$(res.path.session)</SESSION_DIRECTORY>
Apply similar changes for log and tmp. Restart the dispatcher and try again.

Specifying separate appdata directories

If you dedicate a GAS for web application and another one for web services applications on the same host, then it is not recommended to share the appdata/app and appdata/services directories with the main GAS as.xcf. You can override the res.appdata.path resource with, for example, the dispatcher -E option:
httpdispatch -E res.appdata.path=/work/tmp/gas/appdata
Important:

If you start the dispatcher with the option (-E) to override the $(res.appdata.path) location, you must also override the resource when deploying applications with the gasadmin gar command, in order to deploy to the correct directory.

For example, specify the same option with both commands:
  • Starting the dispatcher:

    httpdispatch -E res.appdata.path=/work/tmp/gas/appdata

  • Deploying the application:

    gasadmin gar -E res.appdata.path=/work/tmp/gas/appdata --deploy-archive myapp.gar