zerohop/blog

$ cat spark-firewalls-out-of-memory.md · 12 Nov 2026 · 4 min read

When a policy install runs small firewalls out of memory

#checkpoint#spark#troubleshooting#python

A routine policy install on a fleet of small Check Point Quantum Spark gateways. The install reported success. Traffic kept flowing. And yet, on dozens of gateways, something was clearly wrong.

What happened

These are small appliances with about 2 GB of memory. The policy had grown over time, and this install pushed it over the edge: while the gateway loaded the new policy, the kernel ran out of memory. The OOM killer picked a victim, and it picked sfwd, the process that does much of the work on a Spark.

The watchdog (cpwd) normally restarts a dead process. Not this time: it marked sfwd as terminated and left it there.

text[Expert@gw:0]# cpwd_admin list
APP        PID    STAT  #START  START_TIME
SFWD       0      T     1       [12:34:56]    <- T = terminated (simplified output)

And in the kernel log, the cause:

text[Expert@gw:0]# dmesg | grep -i -E "out of memory|oom"
Out of memory: Killed process ... (sfwd)

Three cpinfo files later, the pattern was the same on every gateway: an OOM during the policy load, sfwd killed, cpwd giving up.

Why rebooting is not the fix

The obvious move is to reboot them all. That's also the trap. After a reboot the gateway loads the same policy again, runs out of memory again, and sfwd dies again, about six minutes after the boot. Long enough to look fixed when you check right after the reboot.

So the order matters:

  1. Make the policy fit first. Together with Check Point TAC the policy was made smaller (in this case by turning a blade off) and installed again.
  2. Test on one gateway, and watch it for at least ten minutes, not one.
  3. Only then reboot the rest, in batches.

Script 1: check, don't guess

The first script logs in to every gateway over SSH, reads cpwd_admin list and dmesg, and writes a report: which gateways are fine, which have sfwd terminated, which were offline. Its second output is a CSV with only the failed gateways, which is exactly the input for the next step.

bashpython3 sfwd_check.py gateways.csv --check-only

That turns "I think about fifty" into a list with names.

Script 2: reboot in batches, and verify

The second script does the reboots, and it's careful on purpose:

bashpython3 batch_reboot.py gateways.csv --dry-run
python3 batch_reboot.py gateways.csv --batch-size 5
python3 batch_reboot.py failed-reboot-<time>.csv     # retry only the ones that didn't end OK

Each gateway in a batch gets its own line on screen, updated in place: checking, rebooting, going down, waiting for ping, waiting for SSH, checking sfwd at 8:00, OK. At the end there's a report and a CSV of whatever still needs attention.

Script 3: what is the state now?

A third, read-only script runs a status round over the fleet: is the blade really off, is sfwd running and since when, how many times has it started, which policy is installed and when. It quickly showed the gateways that needed a human: a few offline, one where the policy fetch failed (don't reboot that one without a way back), one where the blade was still on.

Lessons

← all posts