nerves-project-attic / nerves_network

Connect to wired and wireless networks on Nerves platforms.
Apache License 2.0
58 stars 20 forks source link

Fix default config race condition. #105

Closed ConnorRigby closed 5 years ago

ConnorRigby commented 5 years ago

Thanks for the report @danielspofford

fhunleth commented 5 years ago

What's the race condition? Just wondering since the fix of adding a new process to fix a race condition seems strange.

GregMefford commented 5 years ago

I think the problem was that Nerves.Network.Config was starting before Nerves.Network.IFSupervisor, but it actually depended on it, so now the code that depends on IFSupervisor is moved to a Task after IFSupervisor has started, right?

GregMefford commented 5 years ago

Actually, I think that's still the case: https://github.com/nerves-project/nerves_network/pull/105/files#diff-8af95e60bd806b0cef54791a680ac100R67

fhunleth commented 5 years ago

Wouldn't an easier solution be to start Nerves.Network.Config after Nerves.Network.IFSupervisor?

GregMefford commented 5 years ago

Yeah I was wondering that too, but I'd need to dig more into why it is the way it is now, so maybe Connor knows.

ConnorRigby commented 5 years ago

When I made config be the only process that calls system registry I got errors if it wasn't first, but come to think of it, it may have been the errors that this PR fixes. I'll try making Config start after Ifsupervisor again.

ConnorRigby commented 5 years ago

Well good catch guys. Turns out just moving the Config genserver to start after everything else it eliminates the race. Updated PR coming