The following is taken from the https://docs.rws.com/1031737/157377/contenta-5-12/configuring-iis-with-apache-tomcat
- Contenta Java and Perl API socket timeouts
- Issue: Contenta Java and Perl API calls hang when waiting for response from the Contenta Server
Explanation/resolution: The Contenta Java and Perl API communicate with Contenta Server over the socket. In some cases, such as a server crash, Contenta Server may not respond to requests from the Contenta Java or Perl API. The APIs do not detect that Contenta Server is unavailable and wait for its response. To minimize the wait time, the APIs use a socket read timeout. The length of the timeout is controlled by the settings under the following registry keys.
The following settings under these keys control socket timeout behavior.
SOCKET_TIMEOUT_MILLISECONDS
This setting determines how long the socket will wait for a response. The value is specified in milliseconds, with a default 60000. With this option set to a non-zero timeout, a read() call on the Socket will block for only this amount of time. If the timeout expires, an exception is raised, though the Socket may still be valid (see TRIES_BEFORE_EXIT_ON_SOCKET_TIMEOUT). This option must be enabled before using the Contenta Java or Perl API. The timeout specified must be greater than 0. You can set SOCKET_TIMEOUT_OFF to 1 to turn off the socket timeout; in this case users may experience infinite timeout on a socket read.
TRIES_BEFORE_EXIT_ON_SOCKET_TIMEOUT
The socket may still be valid when a timeout exception is raised. Contenta Java and Perl API will loop (or wait) for the number of tries specified for this setting. This way, if the exception is false, the communication between Contenta Server and the API will continue. After the specified number of tries, if communication between the API and Contenta Server has not resumed, the API raises the exception and closes the socket communication
SOCKET_TIMEOUT_OFF
Set this to 1 to turn off the socket timeouts. If this value is set to 1, users may experience an infinite timeout on socket read. The default value is 0.
Note: Upon exception, the stack trace is written to a standard error, which is eventually captured in a log file. You can search for the string, "Socket timed out" in the log files for the Contenta Java API and the string, "Cannot read socket in sockRead" for the Contenta Perl API. If you find you need to increase the timeout value, RWS recommends you diagnose and fix the Contenta Server performance issues before doing so.