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

is_locked does not work in a persistent context #112

Open
Guibod opened this issue May 30, 2024 · 0 comments
Open

is_locked does not work in a persistent context #112

Guibod opened this issue May 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Guibod
Copy link

Guibod commented May 30, 2024

I’m working with a persistent storage behind a « in memory » instance of Mongodb. It seems that Mongod.is_locked check for lock presence, while mongod leave the file (empty of PID) after a successful shutdown..

To reproduce the issue, you simply need to reuse the same directory after a successful shutdown.

I’d suggest that you move the is_locked method to something similar to this:

    @property
    def is_locked(self):
        lock_file = os.path.join(self.data_folder, "mongod.lock")
        if not os.path.exists(lock_file):
            return False

        return os.path.getsize(lock_file) != 0
@Guibod Guibod added the bug Something isn't working label May 30, 2024
@Guibod Guibod changed the title is_locked does not work is_locked does not work in a persistent context May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant