MAD icon indicating copy to clipboard operation
MAD copied to clipboard

screenshot error in madmin

Open krzee opened this issue 4 years ago • 2 comments

I'm sure we've all seen this plenty, but I didnt see a ticket for it... the madmin devicecontrol page remains static, but devices may disconnect or be rebooted. if somebody clicks to make a screenshot when a device cant be reached we get a python error like:

[2020-07-22 04:31:38,330] ERROR in app: Exception on /take_screenshot [GET] Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/root/MAD/mapadroid/madmin/functions.py", line 31, in decorated return func(*args, **kwargs) File "/root/MAD/mapadroid/madmin/routes/control.py", line 171, in take_screenshot self.generate_screenshot(origin) File "/root/MAD/mapadroid/madmin/routes/control.py", line 188, in generate_screenshot screenshot_quality, screenshot_type) File "/root/MAD/mapadroid/websocket/communicator.py", line 136, in get_screenshot encoded = self.__run_get_gesponse("screen capture {} {}\r\n".format(screenshot_type_str, quality)) File "/root/MAD/mapadroid/websocket/communicator.py", line 47, in __run_get_gesponse worker_instance=self.worker_instance_ref) File "/root/MAD/mapadroid/websocket/WebsocketConnectedClientEntry.py", line 54, in send_and_wait return future.result() File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 435, in result return self.__get_result() File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result raise self._exception File "/root/MAD/mapadroid/websocket/WebsocketConnectedClientEntry.py", line 62, in send_and_wait_async raise WebsocketWorkerConnectionClosedException mapadroid.utils.madGlobals.WebsocketWorkerConnectionClosedException

krzee avatar Jul 22 '20 08:07 krzee

to be clear, theres nothing to actually fix here. there just needs to be something catching the failed attempt to make a screenshot instead of it being an exception

krzee avatar Sep 20 '20 22:09 krzee

Probably we could catch the exceptions on all the calls to the communicator in madmin/routes/control.py and then call self._ws_server.force_disconnect(origin), which would also signal the worker to stop to ensure a cleanup ...? 🤔

crhbetz avatar Oct 14 '20 14:10 crhbetz