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

AttributeError: 'Inotify' object has no attribute '_Inotify__inotify_fd' #91

Open
to7m opened this issue Apr 8, 2021 · 1 comment
Open

Comments

@to7m
Copy link

to7m commented Apr 8, 2021

OS: Arch Linux
Python version: 3.9.1

Originally noticed here: #90, and now I can reproduce it.

The AttributeError keeps popping up, for example in del:

File "/home/to7m/.local/lib/python3.9/site-packages/inotify/adapters.py", line 79, in __del__
    os.close(self.__inotify_fd)
AttributeError: 'Inotify' object has no attribute '_Inotify__inotify_fd'

On my system, the following code reproduces the problem consistently:

from multiprocessing import Process
from inotify.adapters import Inotify
from time import sleep


def proc():
    inotify_obj = Inotify()
    sleep(60)


process_count = 1000
for _ in range(process_count):
    Process(target=proc).start()

It may be necessary to increase process_count on other systems to expose the bug.

@to7m
Copy link
Author

to7m commented Apr 10, 2021

Related: As other issue reports suggest, I think a context manager might help in general.

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

No branches or pull requests

1 participant