Skip to content

Janitor does not handle GDP-mode symlinked 2FA sessions and fails on dead links #565

@jonasbardino

Description

@jonasbardino

As reported by our colleagues at AU (thanks @Bjarke42 ) the janitor fails with log messages like:

2026-06-04 08:37:57,746 INFO handle any pending janitor tasks
2026-06-04 08:37:57,747 ERROR (415) Caught unexpected exception: [Errno 2] No such file or directory: '/PATH/TO/mig/state/twofactor_home/1.2.3.4_RANDOMSESSIONID'

in the regular 2fa clean up on GDP-mode sites.

It looks like the os.path.getmtime(tmp_path) lookup failing when it encounters a dead session symlink in _clean_stale_state_files from clean_twofactor_sessions. It should probably be adjusted to clean up both the symlink and the session file on GDP-mode sites, but at least fail gracefully if such dead links are expected and encountered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions