# Troubleshooting the Service

If you have problems with the service, review these tips.

Problems with the Dockerfile on a Linux node manager
  After the service runs, you can view the Dockerfile that the TERR service writes. You can find the file in the root service directory (for example, /opt/spotfire/nodemanager/<version_#>/nm/services/terr-service-linux-<version_#_ID>/dockerfile/Dockerfile.
  Try test building the Docker image in the environment before starting the TERR service.
  Note: Building an image takes time, so it can take a few minutes for the web UI to display a possible image build failure. If a build failure occurs, the retry mechanism is triggered automatically.
Errors running data functions from a custom package in a container
  If you are running a data function using a custom package in Spotfire from the TERR service running in a Linux container, and you encounter the error message, "`Error executing <functionname> for dynamic library <libname> from package <packagename> loaded from /opt/packages`", then your custom package probably requires a library that is not available to the generic Debian image supplied by default for your docker container. (For example, some libraries require compilation when they are installed, and they link in libraries on the host operating system that do not match the container operating system.)

  To test this issue, set the custom configuration property `use.engine.containers` to `FALSE`, restart the service, and then try running the data function again. This option runs the data function in the engine that is accessible to the operating system and that can access system libraries.

  If the data function runs successfully, and if you want to use containers, then you can create a custom container that uses a version of Debian compatible to your system operating system. See Configuring a custom Docker image on a node with internet access for more information.

Problems with the startup script
  Check your script line endings.
  Important: Remember that for any script you write, the line endings must be appropriate for the operating system where the service runs. Many text editors can perform end-of-line (EOL) conversion.
TERR service, Web Player, or node becomes unresponsive on a regular basis
  This problem can occur if you have installed the TERR service on a node with another Spotfire service, such as the Web Player or Automation Services. Install the TERR service on its own node.

Packages installed on a node manager running a different operating system than the engine
  This unlikely case can happen if, for example, you are running the debian:12-slim Docker image for your TERR service, but your node manager computer is running Red Hat Enterprise Linux (RHEL) 9. Because of symbol version issues, packages must be installed in an equivalent OS to the execution environment. If this is not possible, try one of the following workarounds:
  - Install the packages on a computer running the same operating system as your execution environment, and then copy those packages to the node manager running the other operating system. Provide the path in custom.properties file for the configuration `packagepath`.
  - Create a customized image with debian:12-slim, and then install the required packages in the image. Provide the image name in the custom.properties file in the configuration setting `docker.image.name`.

Error message "Bad Request (400) - Unable to parse form content"

  If you see this error, then the data being uploaded to the service is too large.

  When a data function is run, it sends the relevant data from Spotfire to the TERR service for processing. The TERR service has a file size upload limit, the default of which is 100 MB. When a data function is run with data that exceeds this limit, the TERR service returns the following error:

      Error from Remote Service: Bad Request (400) - Unable to parse form content

         at Spotfire.Dxp.Data.DataFunctions.Executors.RemoteServiceClient.RunFunction(DataFunctionInvocation invocation)
         at Spotfire.Dxp.Data.DataFunctions.Executors.SPlusFunctionExecutor.<ExecuteFunction>d__11.MoveNext()
         at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__8.MoveNext()

  An administrator can change this upload limit if needed by creating a custom configuration.

  If users see this error message, consider creating a custom configuration that increases the limits for both of the following properties:

  Property setting | Description
  --- | ---
  `spring.servlet.multipart.max-file-size` | The total file size for upload cannot exceed the value for this setting.
  `spring.servlet.multipart.max-request-size` | The total request size for a multipart file upload cannot exceed the value for this setting.

  Note: At a certain point, the Java Heap size fails to handle very large files. The threshold for this behavior is dependent on the amount of RAM the TERR service node has. When the Java Heap Size is exceeded, the following error message is displayed:

      Error from Remote Service: Internal Server Error (500) - java.lang.OutOfMemoryError: Java heap space