﻿# A retained faulthandler descriptor can redirect private diagnostics after rotation

A practical investigation of a retained faulthandler descriptor can redirect private diagnostics after rotation, with explicit observations, control cases and evidence limits.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/field-sovereign-faulthandler-retained-descriptor-rotation-destination/
Language: en

## The deployment scenario

A private Python worker configures faulthandler to write restricted diagnostics to a local file. Log rotation closes that file and opens another output using the same descriptor number. A later diagnostic dump can appear in the replacement destination even though the original file path remains in the launch record. The review must follow the retained descriptor, not assume the handler resolves the original pathname anew for every dump.

## The data and control mechanism

Python documents that faulthandler enable, delayed dumps and registered signals keep the output file descriptor. If it is closed and reused, or replaced through dup2, tracebacks can go to a different file. The documentation instructs reconfiguring the handler when the file is replaced. This is distinct from how much content a core dump retains: the immediate issue is where an already configured diagnostic writer actually sends its output.

## Define the intended boundary

Define the diagnostic file lifetime, rotation owner and handler-registration sequence. Include the destination permissions and any component forwarding that output. A descriptor number is meaningful only in its process context and lifetime; reusing it does not preserve the former file identity. Keep the expected diagnostic content separate from routing evidence, because source paths or thread information can still need restricted handling even without a full memory image.

## A step-by-step review

First inspect handler registration and rotation code as text. In a disposable process, configure an approved harmless diagnostic trigger and synthetic output files. Replace the file through the intended rotation-style sequence, then observe which file receives the controlled dump. Repeat with explicit handler reconfiguration and verify the corrected destination. No segmentation fault, live worker crash or private request content is required to test this file-lifetime boundary.

## Evidence required for acceptance

Acceptance requires registration identity, output file identity, descriptor replacement events and the observed receiving file. Preserve a marker distinguishing the old and new destinations without relying only on filenames. A successful rotation command is not evidence that the handler followed the new policy. Record whether delayed or registered handlers also need reconfiguration, rather than fixing only a direct call while another active path retains its former descriptor.

## Failure cases and limits

This check does not prove that every traceback is content-free, that a rotated file was securely erased or that every logging component shares faulthandler behavior. It establishes one writer’s routing lifecycle. A correct file destination still needs appropriate access, retention and export controls. The resulting boundary record should remain tied to the worker and rotation implementation, with unknown downstream forwarding left explicit rather than assumed absent.

## Primary references and related reading

Rebind diagnostic handlers when their output file changes and verify the actual descriptor destination. [Python faulthandler retained output descriptors](https://docs.python.org/3/library/faulthandler.html); [Python descriptor flags and descriptor-relative operations](https://docs.python.org/3/library/os.html).

The proposed investigation of faulthandler retained descriptor rotation destination is a proposed technical boundary review; no production workload or private data was used. Related reading: [Bound crash dumps from large model-serving processes](/journal/guide-linux-coredump-space/); [Inference API telemetry without default prompt capture](/journal/provider-telemetry-content-redaction/).
