Comment 5 for bug 2012659

Revision history for this message
Olivier Gayot (ogayot) wrote :

I reproduced with a brand new USB to ethernet adapter:

2023-03-28 07:42:12,315 DEBUG root:37 start: subiquity/Network/_send_update: DEL enx00e04c680717
2023-03-28 07:42:12,315 DEBUG subiquity.server.controllers.network:355 dev_info enx00e04c680717 {'dhcp4': True}
2023-03-28 07:42:12,315 ERROR root:37 finish: subiquity/Network/_send_update: FAIL: 'NoneType' object has no attribute 'is_connected'
2023-03-28 07:42:12,315 ERROR subiquity.server.server:422 top level error
Traceback (most recent call last):
  File "/snap/subiquity/4542/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquitycore/controllers/network.py", line 215, in _data_ready
    self.observer.data_ready(fd)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/probert/network.py", line 667, in data_ready
    with CoalescedCalls(self):
  File "/snap/subiquity/4542/usr/lib/python3.10/contextlib.py", line 142, in __exit__
    next(self.gen)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/probert/network.py", line 630, in CoalescedCalls
    meth(obj, action, data)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/probert/network.py", line 680, in link_change
    self.receiver.del_link(ifindex)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquitycore/controllers/network.py", line 72, in del_link
    self.controller.del_link(netdev)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquity/server/controllers/network.py", line 379, in del_link
    self._send_update(LinkAction.DEL, dev)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquity/server/controllers/network.py", line 356, in _send_update
    dev_info = dev.netdev_info()
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquitycore/models/network.py", line 201, in netdev_info
    is_connected = bool(self.info.is_connected)
AttributeError: 'NoneType' object has no attribute 'is_connected'
2023-03-28 07:42:12,320 DEBUG subiquity.common.errorreport:384 generating crash report
2023-03-28 07:42:12,320 INFO subiquity.common.errorreport:406 saving crash report 'unknown error crashed with AttributeError' to /var/crash/1679989332.320252895.unknown.crash

When a link disappears, SubiquityNetworkEventReceiver.del_link() calls model.del_link() which sets dev.info to None. Then, the code flows to NetworkController.del_link() which expects dev.info not to be None.

This feels wrong and I suspect the bug could occur without the adapter being disconnected.