Skip to content

Commit

Permalink
[bugfix] SQL Lab 'MySQL has gone away' (apache#150)
Browse files Browse the repository at this point in the history
* Cherry pick apache#4581

* Add flask-compress cherry

* Add shortner fix

* Add Return __time in Druid scan apache#4504

* Picking cherry Fixing regression from apache#4500 (apache#4549)

* [bugfix] SQL Lab 'MySQL has gone away'

It appears the 'MySQL has gone away' is triggered by the line of code
I wrapped in a try block here.

This is a temporary fix, there will be another PR shortly getting to the
bottom of this.

Related:
https://github.com/lyft/druidstream/issues/40
  • Loading branch information
mistercrunch authored Mar 19, 2018
1 parent ab28d7e commit 4625e2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion superset_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@ class CeleryConfig(object):
def get_user_email_cached(username, security_manager):
"""to avoid doing multiple round trips"""
if username not in cached_user_emails:
user = security_manager.find_user(username=username)
user = None
try:
user = security_manager.find_user(username=username)
except Exception as e:
# Pessimistic to avoid 'MySQL has gone away'
logging.error("Couldn't fetch user info")
logging.exception(e)
if user and user.email:
cached_user_emails[username] = user.email
return cached_user_emails.get(username)
Expand Down

0 comments on commit 4625e2f

Please sign in to comment.