overthesun / simoc

A scalable model of an interactive, off-world community
https://ngs.simoc.space/
GNU General Public License v3.0
2 stars 2 forks source link

`kill_all_games` failure on completed sim #86

Open ezio-melotti opened 5 years ago

ezio-melotti commented 5 years ago

If I send a request to the kill_all_games route after all steps have been computed, I get this error:

flask-app_1      | 2019-08-18T09:35:37.761062977Z Traceback (most recent call last):
flask-app_1      | 2019-08-18T09:35:37.761175467Z   File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1612, in full_dispatch_request
flask-app_1      | 2019-08-18T09:35:37.761225945Z     rv = self.dispatch_request()
flask-app_1      | 2019-08-18T09:35:37.761244303Z   File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1598, in dispatch_request
flask-app_1      | 2019-08-18T09:35:37.761292616Z     return self.view_functions[rule.endpoint](**req.view_args)
flask-app_1      | 2019-08-18T09:35:37.761306550Z   File "/usr/local/lib/python3.6/dist-packages/flask_login/utils.py", line 228, in decorated_view
flask-app_1      | 2019-08-18T09:35:37.761320113Z     return func(*args, **kwargs)
flask-app_1      | 2019-08-18T09:35:37.761331880Z   File "/simoc/simoc_server/views.py", line 249, in kill_all_games
flask-app_1      | 2019-08-18T09:35:37.761344377Z     for worker in active_workers:
flask-app_1      | 2019-08-18T09:35:37.761356517Z TypeError: 'NoneType' object is not iterable
flask-app_1      | 2019-08-18T09:35:37.761367849Z [2019-08-18 09:35:37 +0000] [9] [ERROR] ERROR: handling exception 'NoneType' object is not iterable

The FE might send requests to kill_all_games at any time, so I would expect a 200, possibly with a message saying that no games are running.

ezio-melotti commented 5 years ago

I've also observed this in the middle of a 100h sim.

ezio-melotti commented 5 years ago

I changed the FE to call kill_game instead of kill_all_games in https://github.com/kstaats/simoc-web/commit/181b4ac181ebd5f059b7a9b297962650eb9bf956 so this bug shouldn't happen anymore. Currently no one is calling kill_all_games but we will likely restore it in the future and the bug might resurface, so this should still be investigated and fixed, but for now it's low priority.