Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filelock acquire stuck #404

Open
zutb opened this issue Mar 6, 2025 · 2 comments
Open

filelock acquire stuck #404

zutb opened this issue Mar 6, 2025 · 2 comments

Comments

@zutb
Copy link

zutb commented Mar 6, 2025

# coding=utf-8
import time
import asyncio
from threading import Thread
from filelock import FileLock


class TestObject(object):
    def __init__(self):
        self.file_lock = FileLock('/tmp/test_file.lock')
        print("file_lock acquire")
        self.file_lock.acquire()
        print("file_lock acquired")

    def run(self):
        time.sleep(5)
        print("file_lock release")
        self.file_lock.release()
        print("file_lock releasd")


async def test1():
    test_obj = TestObject()
    Thread(target=test_obj.run).start()


async def main():
    await test1()
    time.sleep(1)
    await test1()

if __name__ == '__main__':
    asyncio.run(main())
    time.sleep(10)

Image

@zutb
Copy link
Author

zutb commented Mar 6, 2025

filelock >=3.11.0
This problem exists in versions later than 3.11. 0

@gaborbernat
Copy link
Member

Passes in the CI. That being if you can replicate it within our test suite, then would be easier for someone to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants