Troubleshooting Tip: A Real-World TCP Failure scenario caused by delayed FIN-ACK in a stateful firewall
| Description | This article describes a realistic failure scenario involving a print or a print server that sends a delayed FIN-ACK with reused sequence numbers, causing a firewall to prematurely close the connection and break the print job. | ||||||||
| Scope | FortiGate. | ||||||||
| Solution | Modern enterprise networks rely on stateful firewalls to track every TCP session. These devices expect strict compliance with TCP sequence numbers and teardown rules. When an endpoint violates these rules, even slightly, the firewall may terminate the session, even though both endpoints believe it is still alive.
The topology below shows how a normal session is established:
The print job is sent using TCP port 9100.
Normal session setup: The TCP session is established normally.
The firewall records the session and tracks the sequence numbers:
The print job is transmitted successfully.
The print-server initiates Session-Close: When the job completes, the print server closes the connection first. It sends:
The firewall now expects the next server packet to have:
The client responds correctly:
At this point, the connection is halfway closed.
For any of the reasons outlined below, duplicate FIN-ACKs with the same sequence number may reach the firewall from different print jobs:
Example of duplicate-packet behavior, showing the same sequence number in both FIN-ACK packets:
Upon receiving the first FIN-ACK, the firewall and client terminate their connections. However, while the duplicate FIN-ACK with the same sequence number is delayed, the firewall has already closed the session, but a printer on the print-server network may still await the client's final acknowledgment.
In this scenario, the FortiGate debug flow will display a 'no session matched' message for the second FIN-ACK:
2026-02-02 06:59:24 id=65308 trace_id=55 func=print_pkt_detail line=5811 msg="vd-root received a packet(proto=6, 10.10.10.50:55141->172.16.20.5:9100) tun_id=0.0.0.0 from port9. flag [F.], seq 8001, ack 3000, win 8212" 2026-02-02 06:59:24 id=65308 trace_id=55 func=fw_forward_dirty_handler line=394 msg="no session matched"
The packet will be dropped and the impact on the print job could be:
Conclusion: A single reused sequence number, combined with a delayed or duplicate FIN-ACK from a different flow using the same sequence number, can cause a stateful firewall to mark a valid TCP session as invalid. During print jobs, this leads to intermittent failures, typically occurring under high load or when multiple printers of the same model are connected behind a print server.
Workaround and solution:
This ensures that any remaining FIN-ACK packets can be processed even after the session is closed, with the firewall creating a new session if necessary.
Sample debug flow showing behavior with tcp-session-without-syn configured for all sessions:
2026-02-02 06:59:24 id=65308 trace_id=111 func=init_ip_session_common line=6204 msg="allocate a new session-0001384a"
Related articles: |

