-
Notifications
You must be signed in to change notification settings - Fork 27
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
File access won't be closed on /dev/i2c #247
Comments
I'm pretty busy this weekend, but I can try to take a look next weekend. This was the first python library I wrote, it's likely that there's just something sub-optimal somewhere :) Do you have some simple code I can use to reproduce this? |
Yes of course.
The limit of open files will be reached sooner or later. But keep in mind the limit depends on if the python script is started as a service or started automatically on startup (standard open file limit is 1024 on Raspberry OS on a RPi 4 Model B 2GB). There are more differences if I execute this manually over ssh in the Visual Studio Code terminal the script won't crash. I don't know the difference there yet. So let's grab the problem at the root and try to avoid the multiple open i2c files. :) Huge thanks for the quick support |
Thanks for that reproduction, that was very helpful! This is indeed a bug. When exceptions were generated, which occurred for non-monitor devices on the i2c bus I normally wait for feedback on fixes, but I'm pretty confident that #252 fixes this, so I'll merge that and cut a release. If that doesn't fix it let me know and I can do another release! |
Hi, I've got a problem with the python library.
Everytime I execute
monitorcontrol.get_monitors()
it accesses the file (in my case)/dev/i2c-21
with a new file descriptor.I need to execute it every second and after a few hundred iterations my script crashes with [Errno 24] Too many open files. Because there is a limit of open files on the system (Yes, I could increase the limit, but it won't help) is it possible to dispose whatever the library does there? I need to somehow evade this problem.
Thanks for the help
The text was updated successfully, but these errors were encountered: