ceari / whyattend

World of Tanks Attendance Tracker
BSD 2-Clause "Simplified" License
9 stars 8 forks source link

Interesting issue while logging in into CW Tracker #60

Open enbewu opened 9 years ago

enbewu commented 9 years ago
INFO:whyattend.webapp:Querying Wargaming server for battle schedule of clan 500021712 PSQD
    return self._execute_and_instances(context)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2364, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 662, in execute
    params)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 761, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 874, in _execute_context
    context)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
    exc_info
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 195, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 867, in _execute_context
    context)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 324, in do_execute
    cursor.execute(statement, parameters)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (OperationalError) (2006, 'MySQL server has gone away') 'SELECT player.id AS player_id, player.openid AS player_openid, player.wot_id AS player_wot_id, player.member_since AS player_member_since, player.name AS player_name, player.clan AS player_clan, player.role AS player_role, player.locked AS player_locked, player.lock_date AS player_lock_date, player.email AS player_email, player.phone AS player_phone, player.gold_earned AS player_gold_earned \nFROM player \nWHERE player.openid = %s \n LIMIT %s' ('https://eu.wargaming.net/id/513066661-coffeecat/', 1)

After reload everything worked. What could it be?

enbewu commented 9 years ago

I've noticed bigger than usual load on the server, then I had this error report.

ceari commented 9 years ago

This can happen when MySQL kills connections that are idle for longer than a certain timeout. The application probably tried to reuse one of these connections which lead to this error. I've implemented a workaround described in https://mofanim.wordpress.com/2013/01/02/sqlalchemy-mysql-has-gone-away/ so it shouldn't happen again.