UBC-Thunderbots / Software

Robot Soccer Playing AI
http://www.ubcthunderbots.ca
GNU Lesser General Public License v3.0
53 stars 110 forks source link

Interface argument specification & network listening #3172

Open Bvasilchikov opened 6 months ago

Bvasilchikov commented 6 months ago

Description of the task

There's some odd behaviour on using the flag --disable_communication and not specifying an interface - robot_communication.py throws an error that interface cannot be NoneType and crashes thunderscope completely. this occurs in during context set-up, inside __enter__() method

Acceptance criteria

Blocked By

Bvasilchikov commented 6 months ago

Related to this, Thunderscope uses many network listeners, and based on usage, some never actually get instantiated as an optimization depending on the use case. However, there are .close() methods called inside shutdown hooks, which throw runtime errors and this actually improperly shuts down thunderscope!! This can potentially having some side-effects we don't even know about yet, where stuff is left running in the background...

Bvasilchikov commented 6 months ago

One particular case of the error being thrown is when clicking the "x" button on thunderscope - the following runtime error is logged:

An unknown network error occurred when attempting to shutdown UDP socket for TbotsProto::RobotLog. The boost system error is: Transport endpoint is not connected

The above occurs in RobotCommunication::__exit__(), and when the --disable_communication flag is used.

Swapping the order of self.receive_robot_log.close() and receive_robot_status.close() results in the error message also changing the type of proto, which confirms the issue.