Troubleshooting Tip: Cached memory increases daily due to auto-script output
| Description | This article describes a scenario where a daily increase in cached memory is observed on FortiGate devices. The memory growth is linked to auto-script output files stored in the /tmp directory. Memory usage is released after a device reboot. |
| Scope | FortiOS. |
| Solution | The device shows a steady daily increase in cached memory. The growth is observed in '/tmp/$$auto-script$$/' and is caused by auto-script commands that generate multiple output files.
Example with memory usage:
fnsysctl ls -l /tmp 1503856 /tmp/$$auto-script$$
System time: From X to Y approximately 1-2 days.
Root cause: The auto-script command 'diagnose sniffer packet portx' continuously runs in the background, writing output to temporary files in '/tmp/$$auto-script$$/'. These files are cached in memory and can grow over time.
Auto-script configuration example:
config system auto-script
diagnose sniffer packet port4 none 4 100 l
Resolution steps:
fnsysctl ls -al /tmp/$$auto-script$$/
execute auto-script delete autod.20
The 'execute auto-script delete' command only deletes output files in '/tmp', but does not remove the auto-script configuration itself. Therefore, the scripts continue to run and generate new cached files.
fnsysctl ls -al /tmp/$$auto-script$$/
config system auto-script
get system performance status
Additional information: In some cases, 'autod.*' files under '/tmp/$$auto-script$$/' may continue to grow even after auto-script configuration has been removed.
This behavior can occur due to the following sequence:
Example:
Attempting to delete one of the scripts returns:
execute auto-script delete autod.0.nGz5Du
To avoid this condition, the recommended sequence is:
Note: The 'execute auto-script stopall' command requires at least one auto-script entry to exist under 'config system auto-script'. If all auto-script entries are removed before executing this command, residual processes may remain running.
Starting with FortiOS version 7.6.1, auto-script output file writing has been optimized, and a caching limitation has been introduced to prevent the files from growing indefinitely. |
