can't start after network-online (Fedora 31)
See original GitHub issueI couldn’t get the wsdd.service unit to work on startup, it would fail with the following:
oct 04 14:10:31 principal python3[849]: detected unhandled Python exception in '/usr/local/bin/wsdd'
oct 04 14:10:31 principal wsdd[849]: Traceback (most recent call last):
oct 04 14:10:31 principal wsdd[849]: File "/usr/local/bin/wsdd", line 840, in <module>
oct 04 14:10:31 principal wsdd[849]: sys.exit(main())
oct 04 14:10:31 principal wsdd[849]: File "/usr/local/bin/wsdd", line 833, in main
oct 04 14:10:31 principal wsdd[849]: retval = serve_wsd_requests(addresses)
oct 04 14:10:31 principal wsdd[849]: File "/usr/local/bin/wsdd", line 776, in serve_wsd_requests
oct 04 14:10:31 principal wsdd[849]: http_srv = klass(interface.listen_address, WSDHttpRequestHandler)
oct 04 14:10:31 principal wsdd[849]: File "/usr/lib64/python3.7/socketserver.py", line 452, in __init__
oct 04 14:10:31 principal wsdd[849]: self.server_bind()
oct 04 14:10:31 principal wsdd[849]: File "/usr/local/bin/wsdd", line 64, in server_bind
oct 04 14:10:31 principal wsdd[849]: super().server_bind()
oct 04 14:10:31 principal wsdd[849]: File "/usr/lib64/python3.7/http/server.py", line 137, in server_bind
oct 04 14:10:31 principal wsdd[849]: socketserver.TCPServer.server_bind(self)
oct 04 14:10:31 principal wsdd[849]: File "/usr/lib64/python3.7/socketserver.py", line 466, in server_bind
oct 04 14:10:31 principal wsdd[849]: self.socket.bind(self.server_address)
oct 04 14:10:31 principal wsdd[849]: OSError: [Errno 99] Cannot assign requested address
I went ahead and added a time.sleep(10) right after parse_args() on main() as a stop gap measure, but there’s got to be a proper fix.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (8 by maintainers)
Top Results From Across the Web
Start network services after log-in; not during boot-up : r/Fedora
Using systemd-analyze , I have noticed that sssd.service and NetworkManager-wait-online.service took significant time during the boot process.
Read more >NetworkManager-wait-online fails on boot when 2 NIC are active
It appears that your interfaces are taking 31 seconds to come up, but NM-wait-online's timeout is 30s by default. That's why it's failing....
Read more >How do you restart the network service on Fedora 30?
Open the 'Settings' application in Fedora. In the left column, scroll down to 'Network'; Toggle the blue switch off and back on again...
Read more >Cause a script to execute after networking has started?
On current systems, ordering after network.target just guarantees that the network service has been started, not that there's some actual ...
Read more >Unable to configure service after network-online
[tobiasb@tobias-pc ~]$ cat ~/.config/systemd/user/olad.service [Unit] Description=Open Lighting Architecture service (olad) # Doesn't work ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Perfect! Thanks a lot for your feedback and your efforts in producing it.
Please, don’t feel pressured. Answer whenever possible for you.
Fine. That’s what I’ve expected.
The logs confirm that this is “only” an IPv6 issue. Some research confirmed that in fact a race condition is causing the problem here. When the kernel automatically assigns an IPv6 address to an interface, the IPv6 implementation checks if there are other hosts on the interface’s network with the same address. This is called duplicate address detection (DAD). As long as the DAD is not completed, one cannot bind to the “preliminary” address. According requests result in error 99 on Linux. https://www.agwa.name/blog/post/beware_the_ipv6_dad_race_condition contains a nice summary of the problem.
The DAD is why you face the issue on reboot only, i.e. when the DAD is performed. Manual restarts of wsdd are much likely to happen after the DAD has completed and will therefore not face the problem.
This also explains why your workaround with a call to
sleep
before running all the network stuff in wsdd solves the issue. You can also add a line likeExecStartPre=/bin/sleep 2
to the systemd unit file (or similar for other init systems). This may not hurt the overall experience since the host can still be discovered - even some few seconds later. However, a real solution in the code would respect such situations as well as other changes to interfaces (e.g. changes WiFi networks) but this is more a little more difficult to implement in a portable way for FreeBSD and Linux and it is worth a separate issue.As a temporary workaround, I propose to change the unit file as hinted above. I’ll add an according comment to the template unit file in
etc
and close that issue afterwards.@mikelpr You’re welcome. Thanks for your input, anyways!