Filter streams Converter large confluence zip file import fails because /var fills up Ubuntu 20.04

I expected issues which I had resolved when uploading the same large zip in an xwiki instance running in a docker. I just made docker use another bigger partition.
i.e.: more /etc/docker/daemon.json
{ “data-root”: “/home/docker” }

Now I am running a “production” version in a VM. I thought adding the file setenv.sh to /usr/share/tomcat9/bin containing the line:
export CATALINA_TMPDIR="/disk2/tmp"
to use a larger partition would solve my problem but Filter streams Converter does not use CATALINA_TMPDIR as I had hoped.

root@obl-xwiki:/var/cache/tomcat9/Catalina/localhost/xwiki/xwiki-temp# du -sk *
276	cache
7232892	confluencexml6795228778785489518
48	extension
4	mail
4	svg
root@obl-xwiki:/var/cache/tomcat9/Catalina/localhost/xwiki/xwiki-temp# df .
Filesystem                     1K-blocks    Used Available Use% Mounted on
/dev/mapper/ubuntu--vg-lv--var  10251540 9629336     81740 100% /var

Looks like I need a way to change the tomcat cache location to disk2 but I did not see a variable that lets me do that. Suggestions?

/usr/share/tomcat9/bin/version.sh
Using CATALINA_BASE: /usr/share/tomcat9
Using CATALINA_HOME: /usr/share/tomcat9
Using CATALINA_TMPDIR: /disk2/tmp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/tomcat9/bin/bootstrap.jar:/usr/share/tomcat9/bin/tomcat-juli.jar
Server version: Apache Tomcat/9.0.31 (Ubuntu)
Server built: Oct 20 2020 12:27:39 UTC
Server number: 9.0.31.0
OS Name: Linux
OS Version: 5.4.0-80-generic
Architecture: amd64
JVM Version: 1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
JVM Vendor: Private Build

I doubt this have any effect (unless you are executing some Tomcat script which use this value to set something else before actually running Tomcat).

What you need to set is what is called the “work directory” but how exactly to set it depends a lot on the Tomcat setup, but ultimately it’s supposed to end up setting the Java system property “javax.servlet.context.tempdir”. On Debian based systems, many of those things are set in /etc/defaults/tomcat9.

Thank you. I don’t program in or deploy SW in Java so I could be writing rather stupid things. I am still thinking about what you wrote but please note that adding the file /usr/share/tomcat9/bin/setenv.sh with the line export CATALINA_TMPDIR="/disk2/tmp" has an effect, maybe not the desired one as it resulted in this (see bold)
/usr/share/tomcat9/bin/version.sh
Using CATALINA_BASE: /usr/share/tomcat9
Using CATALINA_HOME: /usr/share/tomcat9
Using CATALINA_TMPDIR: /disk2/tmp

ps -ef | grep tomcat
tomcat 576160 1 99 10:48 ? 00:00:42 /usr/lib/jvm/java-8-openjdk-amd64/bin/java -Djava.util.logging.config.file=/var/lib/tomcat9/conf/logging.properties … … - -Djava.io.tmpdir=/disk2/tmp org.apache.catalina.startup.Bootstrap start

From /usr/share/tomcat9/bin/catalina.sh this is how setenv.sh gets used

if [ -r “$CATALINA_BASE/bin/setenv.sh” ]; then
. “$CATALINA_BASE/bin/setenv.sh”
elif [ -r “$CATALINA_HOME/bin/setenv.sh” ]; then
. “$CATALINA_HOME/bin/setenv.sh”
fi

My xwiki tomcat mariadb env was all installed via apt. Note that I have no /etc/defaults/tomcat9

It’s actually /etc/default/tomcat9 (without the s), sorry.

Feels like CATALINA_TMPDIR affects the temp dir used by Tomcat for its own temporary files, but has no effect on the work dir associated with each application.

Thank you for circling back. I made /var bigger. An answer to this post configuration - How do I set javax.servlet.context.tempdir in Tomcat? - Stack Overflow

suggests adding this to CATALINA_HOME/conf/context.xml

<Context ...>
  ...
  <Parameter name="javax.servlet.context.tempdir" value="/xxx/yyy/....."
         override="false"/>
  ...
</Context>