-
Notifications
You must be signed in to change notification settings - Fork 19
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
Too many open files: '/dev/i2c-1' #5
Comments
If a bus number is passed to However you are correct, the lib does not do any explicit cleanup of the connection since most use cases implicitly close it when Python itself is closed. Python has a def __del__(self):
self._i2c_dev.close() This is probably something I should roll out across all of our libraries, since they are not currently well suited to being used in this manner- ie as part of a plugin that creates/destroys the class repeatedly- but they probably should be. |
With your suggested patch applied:
the open file count to Thank you very much. |
Fix in v0.0.2 |
in this sensor i have problem |
I'm trying to use the SGP30 sensor in a collectd plugin. The plugin is suppossed to write the eco2 value to an InfluxDB.
Therefore I'm initiliazing the sensor with:
before starting collectd.
From within collectd the follwowing code is executed every 10 seconds.
and then written to the InfluxDB.
Sending the command seems to call SMBUS.open() implicitly in line 76:
self._i2c_dev.i2c_rdwr(msg_w)
But there is no
self._i2c_dev.close()
.In my case this left 11 file handles to /dev/i2c-1 open on every call of the plugin script.
So the file handle needs to be closed somewhere...
Where is the best place in the lib to cleanup the connection?
As a quick and dirty solution I added a
close()
-call at line 90 afterverified = []
The text was updated successfully, but these errors were encountered: