alfg / guildbit

:sound: Mumble Hosting Platform
https://guildbit.com
56 stars 8 forks source link

Creating 2 servers at the same time issue #16

Closed alfg closed 8 years ago

alfg commented 10 years ago

Got this error today:

Exception on /server/2bb3e52b-d024-4a7d-9fcd-0102e289086b [GET]
Traceback (most recent call last):
  File "/srv/guildbit/env/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/srv/guildbit/env/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/srv/guildbit/env/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/srv/guildbit/env/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/srv/guildbit/env/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/srv/guildbit/env/local/lib/python2.7/site-packages/flask_classy.py", line 216, in proxy
    response = view(**request.view_args)
  File "/srv/guildbit/app/controllers/server.py", line 19, in get
    server_details = murmur.get_server(server.mumble_host, server.mumble_instance)
  File "/srv/guildbit/app/murmur.py", line 119, in get_server
    r = requests.get("%s/servers/%i" % (uri, instance_id), auth=HTTPDigestAuth(auth['username'],
TypeError: %d format: a number is required, not NoneType

Turns out 2 servers were created at the same time (to the second) which both tried to assign the same port. However, the 2nd server wasn't able to start since the port was reserved already and therefore errored out.

This ends up leaving the 2nd server without a port, not running and unable to shutdown in the admin interface since an exception just occurs when accessing the server page.

Quick fix is to update status to expired via sql and shutdown instance via murmur-rest manually.

Long term fix is to rework the deploy server code a bit to atomically create servers with transactions.