If the camera does not properly get initialized, the webserver port will not get properly released. The next time the TauLidarServer program is run, there will be a OSError: [Errno 48] Address already in use error.
The user must run the program with an argument to set a new port.
Steps to Reproduce
Use a bad cable and try to run TauLidarServer
Observe bad frame ignored error messages from the camera
Data error, actual size: 36156, expected size: 38480
Bad frame ignored, bytes length: 36076
skip frame
Bad frame ignored, bytes length: 0
skip frame
Bad frame ignored, bytes length: 0
skip frame
Exit the program with Ctrl+C
Restart the program
Observe error message:
Looking for connected Tau LiDAR Camera hardware ...
DATA ERROR - length is 0
ToF camera opened successfully:
model: 4.0
firmware: 3.3
uid: 69.549
resolution: 160x60
port: /dev/cu.usbmodem00000000001A1
IP address: 127.0.0.1
URL: http://127.0.0.1:8080
Press Ctrl + C keys to shutdown ...
Traceback (most recent call last):
File "/Users/lazar/.pyenv/versions/3.8.3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/lazar/.pyenv/versions/3.8.3/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/lazar/workspace/onion/tau/tau-lidar-server/TauLidarServer/__main__.py", line 30, in <module>
main()
File "/Users/lazar/workspace/onion/tau/tau-lidar-server/TauLidarServer/__main__.py", line 27, in main
server.serverLoop()
File "/Users/lazar/workspace/onion/tau/tau-lidar-server/TauLidarServer/server.py", line 164, in serverLoop
httpd = socketserver.TCPServer(("", HTTP_PORT), Handler)
File "/Users/lazar/.pyenv/versions/3.8.3/lib/python3.8/socketserver.py", line 452, in __init__
self.server_bind()
File "/Users/lazar/.pyenv/versions/3.8.3/lib/python3.8/socketserver.py", line 466, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 48] Address already in use
^CException ignored in: <module 'threading' from '/Users/lazar/.pyenv/versions/3.8.3/lib/python3.8/threading.py'>
Traceback (most recent call last):
File "/Users/lazar/.pyenv/versions/3.8.3/lib/python3.8/threading.py", line 1388, in _shutdown
lock.acquire()
KeyboardInterrupt:
What is expected?
If the camera fails to initialize properly and the user exits the program with ctrl+c, the program should release the webserver port before shutting down.
What is actually happening?
The program closes and does not release the port. The user must specify a new port if they want to use the program.
Python and Library versions
Python 3.8.3
Camera Info
Describe the bug
If the camera does not properly get initialized, the webserver port will not get properly released. The next time the TauLidarServer program is run, there will be a
OSError: [Errno 48] Address already in use
error.The user must run the program with an argument to set a new port.
Steps to Reproduce
What is expected?
If the camera fails to initialize properly and the user exits the program with ctrl+c, the program should release the webserver port before shutting down.
What is actually happening?
The program closes and does not release the port. The user must specify a new port if they want to use the program.