-
Notifications
You must be signed in to change notification settings - Fork 716
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
Add method to detect if network has changed and reinitialize zeroconf #8231
Add method to detect if network has changed and reinitialize zeroconf #8231
Conversation
Hi @jamalex I tested this build on 2 Windows 10 laptops and now it's not possible to import a facility at all. Here's a screenshot with the same issue observed when I attempt to import a facility from Device>Facilities: I'm also observing unusually high CPU usage with this build: Here are the logs from both laptops: |
Hello @pcenov that's an issue that was solved yesterday. Are you using the build that was created yesterday? https://github.com/learningequality/kolibri/releases/tag/v0.15.0-alpha2 That should have that problem solved. |
7b1b1ff
to
025c096
Compare
Hi @pcenov I have rebased this branch now. |
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.
This feels a little circular, but I approve this PR.
Hi @rtibbles I did another test run on this using this build and unfortunately the issue described in #8227 is still present. Here are the logs: Let me know if you need additional info or anything else. |
Summary
We identified that zeroconf doesn't pick up when a new network connection is established, so it doesn't become discoverable on networks that it wasn't connected to at the time Kolibri started up.
This PR adds a method for detecting when the set of bound IP addresses on the system has changed, and reinitializing the zeroconf internals to ensure they're attached to each of those IPs.
Note: no code has been added to actually call this new method. We may want to spawn a thread that calls it every minute (as it should be very lightweight most of the time, since it's checking the list of bound IPs against its cached copy and only doing something if it changes). We'll need to ensure it happens in the same process, as the zeroconf state is process-local (in global vars inside
kolibri.core.discovery.utils.network.search
), so we may not want to use iceqube.Reviewer guidance
To test:
kolibri shell
, and runfrom kolibri.core.discovery.utils.network.search import *; register_zeroconf_service(999)
[p["device_name"] for p in get_peer_instances()]
, and you should only see your own machine name[p["device_name"] for p in get_peer_instances()]
again several times, waiting in between, and you should still only see your own machine namereinitialize_zeroconf_if_network_has_changed()
[p["device_name"] for p in get_peer_instances()]
again. After a short time, it should start showing the name of the other device on your network in the list as well.Hopefully sorts out #8227
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)