Skip to content

is_singleton=True with nested lock hangs #331

@yugokato

Description

@yugokato

I noticed the following code hangs. Is this not a supported usage?

from filelock import FileLock

with FileLock('.lock', is_singleton=True):
    with FileLock('.lock', is_singleton=True):
        ...

This works fine:

from filelock import FileLock

lock1 = FileLock('.lock', is_singleton=True)
lock2 = FileLock('.lock', is_singleton=True)
with lock1:
    with lock2:
        ...

Environment:

  • Python 3.11.9
  • filelock==3.14.0
  • platform=MacOS Sonoma 14.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions