Closed Julusian closed 1 year ago
Oops, I’ll fix this
Thanks, guys! That was a lot of fun trying to nail down the source of the bug...
@isaiahfranco can you help me test?
@josephdadams Of course!
@josephdadams What do you need me to do?
I’ll ping you when I have it ready. I forgot that I started rewriting it awhile back to fix this bug and add some stuff 😂
@josephdadams Strangely enough, this issue has gotten worse lately. Today alone, I've had to quit and restart Companion three times. Any ETA on when the update will be ready?
I have not had time to come back to it...
@josephdadams @Julusian Is there anyone that can take a look at this issue? It's causing me to restart Companion every time one of my bulbs or plugs goes offline.
@isaiahfranco have you tried the latest code?
@josephdadams I don't see this as being fixed. Both times reject(
is called, it still isnt closing the socket https://github.com/bitfocus/companion-module-tplink-kasasmartbulb/blob/master/src/utils.js#L170-L182
On an unrelated note, the parsing of variables looks to be broken, having not been updated to the new way needed for 3.0 https://github.com/bitfocus/companion-module-tplink-kasasmartbulb/blob/master/src/actions.js#L31-L33
@digitaldrummerj can you take a look? I don't think I have any of these bulbs anymore
@Julusian @josephdadams just submitted PR to hopefully fix the sockets close and parsing variable issue.
https://github.com/bitfocus/companion-module-tplink-kasasmartbulb/blob/71c7c9ee35d85081635a858db2fdf34b485bbef6/src/actions.js#L31
Every time
send
is called it is opening a new udp socket on a random port. But you are only closing them if you get a response. If the device does not respond will eventually lead to exhausting all the possible port numbers, and stop things from working (eg https://github.com/bitfocus/companion/issues/2108)You need to make sure to fail the call after some timeout, and clean it up, or it might be better to create the socket once as part of init and updateConfig and reuse it? It will require more care when listening for responses, but will ensure this can never happen