Skip to content

Crash random perché perde la connessione al DB #3

@drago-96

Description

@drago-96

Ogni tanto il sito non mostra più le statistiche; questo è dovuto al fatto che in qualche modo perde la connessione al DB, e quindi non riesce più ad eseguire query.
Allego un po' di tracebacks:

127.0.0.1 - - [2019-02-19 03:22:52] "GET // HTTP/1.1" 200 1927 0.000470
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/subotto-web/24web/24h.py", line 68, in update_scores
    ORDER BY year DESC LIMIT 1;""");
OperationalError: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

<Greenlet at 0x7fbe8c103410: <bound method SubottoWeb.update_scores of <__main__.SubottoWeb object at 0x7fbe8f707f50>>> failed with OperationalError

Poi si lamenta che la connessione si è chiusa:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 884, in handle_one_response
    self.run_application()
  File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 870, in run_application
    self.result = self.application(self.environ, self.start_response)
  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 599, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 40, in <lambda>
    return update_wrapper(lambda *a: f(*a)(*a[-2:]), f)
  File "/home/subotto-web/24web/24h.py", line 543, in __call__
    data = self.score_handler(data)
  File "/home/subotto-web/24web/24h.py", line 139, in score_handler
    ORDER BY sec;""", (data['year'],))
OperationalError: SSL connection has been closed unexpectedly

E infine non riesce ad ottenere una nuova connessione:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 884, in handle_one_response
    self.run_application()
  File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 870, in run_application
    self.result = self.application(self.environ, self.start_response)
  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 599, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 40, in <lambda>
    return update_wrapper(lambda *a: f(*a)(*a[-2:]), f)
  File "/home/subotto-web/24web/24h.py", line 545, in __call__
    data = self.stats_handler(data)
  File "/home/subotto-web/24web/24h.py", line 156, in stats_handler
    with self.get_cursor() as cur:
  File "/home/subotto-web/24web/24h.py", line 108, in get_cursor
    return c.cursor()
InterfaceError: connection already closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions