New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legacy webapp fails to initialize settlement; boots users #502

toconnell opened this Issue May 15, 2018 · 2 comments


None yet
1 participant

toconnell commented May 15, 2018

Legacy webapp crash email:

[5a1cd6c98740d9723e6441fa] was logged out of the webapp instance on ubuntu-trusty-1 due to a render failure at 2018-05-15 02:48:00.668941.

 The traceback from the exception was this:
Traceback (most recent call last):
File "/home/toconnell/kdm-manager/v1/", line 37, in wrapper
 return func(self, *args, **kwargs)
File "/home/toconnell/kdm-manager/v1/", line 553, in current_view_html
File "/home/toconnell/kdm-manager/v1/", line 330, in set_current_settlement
 self.Settlement = assets.Settlement(settlement_id=s_id, session_object=self)
File "/home/toconnell/kdm-manager/v1/", line 633, in __init__
File "/home/toconnell/kdm-manager/v1/", line 653, in set_settlement
 raise Exception("Could not initialize requested settlement %s!" % s_id)
Exception: Could not initialize requested settlement 5afa4a5f8740d928885aeea8!

assets.Settlement.init() calls set_settlement(), which sometimes bombs. Here's that method:

 646     def set_settlement(self, s_id, update_mins=False):
 647         """ Sets self.settlement. """
 649         self.settlement = mdb.settlements.find_one({"_id": s_id})
 651         if self.settlement is None:
 652             self.logger.error("[%s] failed to initialize settlement _id: %s" % (self.User, s_id))
 653             raise Exception("Could not initialize requested settlement %s!" % s_id)

I've gotten three of these since the last release, so there's something going on here.

It appears to be affecting new and older users: last night's user is 168 days old and the one from the 13th (two days ago) was brand new at the time.

Kind of scratching my head here.

@toconnell toconnell added bug v2 labels May 15, 2018

@toconnell toconnell self-assigned this May 15, 2018


This comment has been minimized.


toconnell commented May 16, 2018

Something's going on where the asset ID being requested is like...not an OID and is getting coerced to it. The actual OID is in the params, but for some reason, appears to be losing the plot somewhere.

Le sigh.


This comment has been minimized.


toconnell commented May 16, 2018

Turns out that session.Session.change_current_view() was only setting self.session['current_settlement'] for the 'view_campaign' view, i.e. not for 'view_settlement'.

The result was that we were duck-typing None to an OID and thus getting an invalid settlement ID, etc.

This legacy webapp really...needs to go away.

Anyway, fix will be deployed in the next release.

@toconnell toconnell closed this May 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment