-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Plug file leak on LIFX unregister #7031
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
Conversation
The aiolifx 0.4.4 release closes its socket when the unregister callback is called. This plugs a file descriptor leak but also means that we must be careful to not use the device after it goes unavailable. Also, when a light reappears, it has a new device that must be used.
@@ -265,6 +269,9 @@ def async_turn_on(self, **kwargs): | |||
@asyncio.coroutine | |||
def async_turn_off(self, **kwargs): | |||
"""Turn the device off.""" | |||
if not self.available: | |||
return | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if that make more sense to use it on Export_entity on ServiceComponent...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove that, I will make a PR for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. It was already in async_update
before, can I remove it from there as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No update is needed, otherwise the device have no access to come back to available state. On update you need check if the device back to controll or stay available until next update call. But update is only needed on a polling device. If you have a callback and no polling device, you can update the property on callback function.
The core will learn to handle that.
* Plug file leak on LIFX unregister The aiolifx 0.4.4 release closes its socket when the unregister callback is called. This plugs a file descriptor leak but also means that we must be careful to not use the device after it goes unavailable. Also, when a light reappears, it has a new device that must be used. * Do not test self.available in service calls The core will learn to handle that.
Cherry picked for 0.42.3 |
After home-assistant#7031 the LIFX device will change during an unregister/register transition. This has the user-visible effect of the new device missing a friendly name until the next poll. We now cache the name internally and it will then transfer to the new device when it registers.
* Cache the name of LIFX lights After #7031 the LIFX device will change during an unregister/register transition. This has the user-visible effect of the new device missing a friendly name until the next poll. We now cache the name internally and it will then transfer to the new device when it registers. * Allow LIFX logging even without an available device This will allow us to set the device to None when it unregisters. * Calculate LIFX availability from the existence of a device This has become possible because the device is no longer needed to provide the name of the light when it is unavailable. We just have to forget the device when it unregisters.
Description:
The aiolifx 0.4.4 release closes its socket when the unregister callback is
called. This plugs a file descriptor leak but also means that we must be
careful to not use the device after it goes unavailable.
Also, when a light reappears, it has a new device that must be used.
Related issue (if applicable): fixes #6985
Checklist:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully.requirements_all.txt
by runningscript/gen_requirements_all.py
.