Page MenuHomePhabricator

'ascii' codec can't decode byte 0xe2 in position 4: ordinal not in range(128)
Closed, ResolvedPublic

Description

After authorizing the tool, I was redirected to
https://tools.wmflabs.org/oabot/get-random-edit
where I get a blank page with the following error message:

OAbot
Oops! Something went wrong.

Error:
'ascii' codec can't decode byte 0xe2 in position 4: ordinal not in range(128)
Traceback (most recent call last):
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/data/project/oabot/www/python/src/app.py", line 174, in get_random_edit
cache_fname = "cache/"+to_cache_name(page_name)
File "/data/project/oabot/www/python/src/app.py", line 146, in to_cache_name
safe_page_name = page_name.replace('/','#').replace(' ','_').encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 4: ordinal not in range(128)

I was using Firefox when this happened, and after I reloaded the same page I got:

OAbot
Oops! Something went wrong.

Error:
(_mysql_exceptions.OperationalError) (2006, 'MySQL server has gone away') [SQL: u'SELECT userstats.id AS userstats_id, userstats.wiki AS userstats_wiki, userstats.user_name AS userstats_user_name, userstats.nb_edits AS userstats_nb_edits, userstats.nb_links AS userstats_nb_links \nFROM userstats \nWHERE userstats.wiki = %s AND userstats.user_name = %s \n LIMIT %s'] [parameters: ('en', u'He7d3r', 1)]
Traceback (most recent call last):
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/data/project/oabot/www/python/src/app.py", line 139, in review_one_edit
nb_edits = UserStats.get('en', username).nb_edits
File "./userstats.py", line 75, in get
instance = session.query(cls).filter_by(wiki=wiki, user_name=user).first()
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2755, in first
ret = list(self[0:1])
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2547, in __getitem__
return list(res)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
return self._execute_and_instances(context)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 945, in execute
return meth(self, multiparams, params)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
compiled_sql, distilled_params
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
context)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
exc_info
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (_mysql_exceptions.OperationalError) (2006, 'MySQL server has gone away') [SQL: u'SELECT userstats.id AS userstats_id, userstats.wiki AS userstats_wiki, userstats.user_name AS userstats_user_name, userstats.nb_edits AS userstats_nb_edits, userstats.nb_links AS userstats_nb_links \nFROM userstats \nWHERE userstats.wiki = %s AND userstats.user_name = %s \n LIMIT %s'] [parameters: ('en', u'He7d3r', 1)]

Then I reloaded it again and got a working page.

Event Timeline

He7d3r created this task.Oct 23 2017, 9:26 PM
Ocaasi_WMF raised the priority of this task from High to Needs Triage.Oct 27 2017, 8:02 PM
Ocaasi_WMF triaged this task as Medium priority.

@Ocaasi_WMF A fix was deployed for this. Was it fixed?

I've not seen this bug again, while I used to see it from time to time, so it might be fixed. I cannot find the original error in the logs so I cannot tell whether it stopped occurring...

Samwalton9 closed this task as Resolved.Nov 6 2018, 10:21 AM
Samwalton9 claimed this task.

I'm going to flag this as resolved - we can re-open if the error shows up again.