unstale

pypi / filelock

filelock

What changed in filelock 3 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-04.

9 breaking20 security1 tooling15 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

filelock 443 changes

Breaking changes 9

  • UnixFileLock now refuses with PermissionError a lock file owned by another account under a sticky parent, preventing two processes from holding locks at the same path. Files owned by the directory owner are still accepted.

    4.2.12release notes

  • If a lock transition another thread never finishes blocks a fork, the child exits with status 70 after 30 seconds and the parent continues.

    4.2.11release notes

  • On runtimes without dir_fd other than Windows, it refuses a protocol directory owned by another account under a sticky parent.

    4.2.11release notes

  • Contended FileLock and SoftFileLock acquisitions now raise Timeout when elapsed time reaches the requested timeout, avoiding indefinite retries at the deadline.

    4.2.10release notes

  • ReadWriteLock, SoftReadWriteLock and their async wrappers now raise TypeError when blocking is not a bool, in the constructor and on acquire.

    4.2.9release notes

  • A non-bool blocking argument now raises TypeError instead of being treated as truthy, which could make a single-attempt call wait for the timeout.

    4.2.5release notes

  • Resolving the name now raises ImportError when a missing module other than sqlite3 prevents loading it; the name is None only when SQLite is unavailable.

    4.2.5release notes

  • Resolving the name now raises ImportError when a missing module other than sqlite3 prevents loading it; the name is None only when SQLite is unavailable.

    4.2.5release notes

  • A forked child of a process holding a lease now starts with an unheld claim instead of inheriting the parent's token, compromise, and heartbeat.

    4.2.5release notes

Security 18

  • filelock: On Windows an oplock on a soft lock's marker holds SoftFileLock.acquire() past its timeout and blocks the stale break

    4.2.1security advisory

  • filelock ReadWriteLock: a crafted lock database makes every acquire stall or hang regardless of timeout

    4.2.1security advisory

  • filelock: ReadWriteLock on the hard-link route deletes any directory another user renames onto its .filelock-* link directory name

    4.2.1security advisory

  • filelock: ReadWriteLock on Windows acts on SQLite side files another local user places beside its database

    4.2.1security advisory

  • filelock ReadWriteLock: SQLite reopens the lock database by name, so a planted symlink or journal file makes the lock user's process overwrite or unlink its own files

    4.2.1security advisory

  • filelock: SoftFileLock evicts a fresh lock file whose watched age another local user's pre-dated file passed on through inode reuse

    4.2.1security advisory

  • filelock: SoftFileLock removes a live holder's marker when another user forges the PID in a writable marker

    4.2.1security advisory

  • filelock: SoftFileLock stale-break restore follows a swapped-in symbolic link and hard-links a file of the user running the lock into the lock directory

    4.2.1security advisory

  • filelock: SoftFileLock stale-lock break removes a live lock file on a reused inode number and admits two holders

    4.2.1security advisory

  • filelock: SoftReadWriteLock follows a lock tree swapped in after its first acquire and writes lock records into directories of the user running the lock

    4.2.1security advisory

  • filelock: SoftReadWriteLock holder refresh writes through a hard link and hangs on a named pipe that another local user renames over its record

    4.2.1security advisory

  • filelock: StrictSoftFileLock and SoftReadWriteLock adopt a protocol directory another user created first, losing mutual exclusion

    4.2.1security advisory

  • filelock: StrictSoftFileLock creates its claim directories without the lock mode, so another local user with a write bit on them can end a live hold

    4.2.1security advisory

  • filelock: StrictSoftFileLock follows a symbolic link swapped in at <path>.filelock and creates claim files in a directory another local user chooses

    4.2.1security advisory

  • filelock: Symlink swap during SoftFileLock's writability check leaks whether a path exists and is writable by the lock taker

    4.2.1security advisory

  • filelock: UnixFileLock truncates and chmods any regular file another user renames or hard-links onto the lock path

    4.2.1security advisory

  • filelock: WindowsFileLock ignores mode: a 0o600 lock file and the ReadWriteLock database inherit the directory ACL

    4.2.1security advisory

  • filelock: ReadWriteLock follows a symlink at the lock path into SQLite

    4.0.9security advisory

Tooling 1

  • Every wheel now includes a PEP 770 CycloneDX SBOM in its .dist-info/sboms directory, written at build time by python-sbom.

    4.2.10release notes

Fixes and other changes 15

  • With a poll_interval below 0.05 seconds, contended retries use a jittered, widening window instead of a fixed interval.

    4.2.11release notes

  • Locks still referenced at interpreter exit are released before module teardown, with exceptions for running daemon-thread holds and thread_local=False locks while another thread runs.

    4.2.11release notes

  • On Windows, paths differing only in drive-letter or UNC-share case share a singleton and trigger same-thread deadlock detection.

    4.2.11release notes

  • Dropping a lock during interpreter shutdown, including read-write locks, no longer prints an ignored exception at exit.

    4.2.11release notes

  • Garbage collection on its own heartbeat thread no longer deadlocks that thread and leaves later os.fork() calls waiting forever.

    4.2.11release notes

  • Releasing a soft lock whose marker was replaced by a peer no longer raises AttributeError on GraalPy.

    4.2.11release notes

  • Reclaims a dead holder's lease marker despite a different lease duration, preventing the lock from staying wedged; a live holder with a different duration still raises LeaseSettingsMismatch.

    4.2.7release notes

  • Fixes a race affecting SoftFileLock, MarkerSoftFileLock and SoftFileLease when three or more contenders reclaim a dead marker, preventing a live holder's marker from being stranded or a second holder from being admitted.

    4.2.6release notes

  • Nested acquisition of a held FileLock or SoftFileLock no longer recreates the lock file's parent directory after it has been renamed.

    4.2.5release notes

  • A read-only reopen now uses the path pinned during acquisition, avoiding resolution against a changed working directory after a refused read-write open.

    4.2.5release notes

  • Acquisition now works in group-writable directories with inherited ACLs by restricting the link directory's write access to its owner, including on filesystems that refuse to close it.

    4.2.5release notes

  • The protocol tree now handles EMLINK from a no-follow open that refuses a symlink, so heartbeat reports lost ownership rather than a transient refresh error.

    4.2.5release notes

  • If the first read of a new marker's identity fails, the lock reads it again before rollback, preventing an empty marker from blocking later acquisitions on Windows.

    4.2.5release notes

  • Stranded restore claims with out-of-range process numbers or non-ASCII digits are ignored, preventing overflow errors and locks that cannot reclaim dead holders.

    4.2.5release notes

  • On Windows, a soft lock no longer waits forever by retaining a marker for an exited holder when another process still holds a handle to it.

    4.2.5release notes

filelock 32 changes

Security 2

  • filelock Time-of-Check-Time-of-Use (TOCTOU) Symlink Vulnerability in SoftFileLock

    3.20.3security advisory

  • filelock has a TOCTOU race condition which allows symlink attacks during lock file creation

    3.20.1security advisory