onopon / spotto_league

SPOTTOのリーグ戦システム
0 stars 0 forks source link

たまに起きるmysql time out #21

Closed onopon closed 3 years ago

onopon commented 3 years ago

spotto_league $ heroku logs --tail
2021-04-23T18:41:22.783227+00:00 app[web.1]: raise exc
2021-04-23T18:41:22.783228+00:00 app[web.1]: pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '153.121.51.117' (timed out)")
2021-04-23T18:41:22.783228+00:00 app[web.1]:
2021-04-23T18:41:22.783228+00:00 app[web.1]: The above exception was the direct cause of the following exception:
2021-04-23T18:41:22.783228+00:00 app[web.1]:
2021-04-23T18:41:22.783229+00:00 app[web.1]: Traceback (most recent call last):
2021-04-23T18:41:22.783229+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1982, in wsgi_app
2021-04-23T18:41:22.783229+00:00 app[web.1]: response = self.full_dispatch_request()
2021-04-23T18:41:22.783230+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1614, in full_dispatch_request
2021-04-23T18:41:22.783230+00:00 app[web.1]: rv = self.handle_user_exception(e)
2021-04-23T18:41:22.783234+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1517, in handle_user_exception
2021-04-23T18:41:22.783235+00:00 app[web.1]: reraise(exc_type, exc_value, tb)
2021-04-23T18:41:22.783235+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/_compat.py", line 33, in reraise
2021-04-23T18:41:22.783235+00:00 app[web.1]: raise value
2021-04-23T18:41:22.783235+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1612, in full_dispatch_request
2021-04-23T18:41:22.783236+00:00 app[web.1]: rv = self.dispatch_request()
2021-04-23T18:41:22.783244+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1598, in dispatch_request
2021-04-23T18:41:22.783244+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args)
2021-04-23T18:41:22.783244+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_httpauth.py", line 164, in decorated
2021-04-23T18:41:22.783245+00:00 app[web.1]: return f(*args, **kwargs)
2021-04-23T18:41:22.783245+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_login/utils.py", line 270, in decorated_view
2021-04-23T18:41:22.783245+00:00 app[web.1]: elif not current_user.is_authenticated:
2021-04-23T18:41:22.783246+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/werkzeug/local.py", line 348, in __getattr__
2021-04-23T18:41:22.783246+00:00 app[web.1]: return getattr(self._get_current_object(), name)
2021-04-23T18:41:22.783246+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/werkzeug/local.py", line 307, in _get_current_object
2021-04-23T18:41:22.783247+00:00 app[web.1]: return self.__local()
2021-04-23T18:41:22.783247+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_login/utils.py", line 26, in <lambda>
2021-04-23T18:41:22.783247+00:00 app[web.1]: current_user = LocalProxy(lambda: _get_user())
2021-04-23T18:41:22.783248+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_login/utils.py", line 346, in _get_user
2021-04-23T18:41:22.783248+00:00 app[web.1]: current_app.login_manager._load_user()
2021-04-23T18:41:22.783248+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_login/login_manager.py", line 318, in _load_user
2021-04-23T18:41:22.783249+00:00 app[web.1]: user = self._user_callback(user_id)
2021-04-23T18:41:22.783249+00:00 app[web.1]: File "/app/application.py", line 229, in user_loader
2021-04-23T18:41:22.783249+00:00 app[web.1]: name_tuples = db.session.query(User.login_name).all()
2021-04-23T18:41:22.783250+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3373, in all
2021-04-23T18:41:22.783250+00:00 app[web.1]: return list(self)
2021-04-23T18:41:22.783257+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3535, in __iter__
2021-04-23T18:41:22.783257+00:00 app[web.1]: return self._execute_and_instances(context)
2021-04-23T18:41:22.783258+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3556, in _execute_and_instances
2021-04-23T18:41:22.783258+00:00 app[web.1]: conn = self._get_bind_args(
2021-04-23T18:41:22.783258+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3571, in _get_bind_args
2021-04-23T18:41:22.783259+00:00 app[web.1]: return fn(
2021-04-23T18:41:22.783259+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3550, in _connection_from_session
2021-04-23T18:41:22.783259+00:00 app[web.1]: conn = self.session.connection(**kw)
2021-04-23T18:41:22.783260+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1142, in connection
2021-04-23T18:41:22.783260+00:00 app[web.1]: return self._connection_for_bind(
2021-04-23T18:41:22.783260+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1150, in _connection_for_bind
2021-04-23T18:41:22.783261+00:00 app[web.1]: return self.transaction._connection_for_bind(
2021-04-23T18:41:22.783261+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 433, in _connection_for_bind
2021-04-23T18:41:22.783262+00:00 app[web.1]: conn = bind._contextual_connect()
2021-04-23T18:41:22.783262+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2302, in _contextual_connect
2021-04-23T18:41:22.783262+00:00 app[web.1]: self._wrap_pool_connect(self.pool.connect, None),
2021-04-23T18:41:22.783263+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2339, in _wrap_pool_connect
2021-04-23T18:41:22.783263+00:00 app[web.1]: Connection._handle_dbapi_exception_noconnection(
2021-04-23T18:41:22.783265+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1583, in _handle_dbapi_exception_noconnection
2021-04-23T18:41:22.783265+00:00 app[web.1]: util.raise_(
2021-04-23T18:41:22.783266+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
2021-04-23T18:41:22.783266+00:00 app[web.1]: raise exception
2021-04-23T18:41:22.783266+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
2021-04-23T18:41:22.783267+00:00 app[web.1]: return fn()
2021-04-23T18:41:22.783271+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 364, in connect
2021-04-23T18:41:22.783271+00:00 app[web.1]: return _ConnectionFairy._checkout(self)
2021-04-23T18:41:22.783271+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
2021-04-23T18:41:22.783272+00:00 app[web.1]: fairy = _ConnectionRecord.checkout(pool)
2021-04-23T18:41:22.783272+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
2021-04-23T18:41:22.783272+00:00 app[web.1]: rec = pool._do_get()
2021-04-23T18:41:22.783273+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 140, in _do_get
2021-04-23T18:41:22.783273+00:00 app[web.1]: self._dec_overflow()
2021-04-23T18:41:22.783273+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
2021-04-23T18:41:22.783274+00:00 app[web.1]: compat.raise_(
2021-04-23T18:41:22.783274+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
2021-04-23T18:41:22.783274+00:00 app[web.1]: raise exception
2021-04-23T18:41:22.783280+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 137, in _do_get
2021-04-23T18:41:22.783281+00:00 app[web.1]: return self._create_connection()
2021-04-23T18:41:22.783281+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
2021-04-23T18:41:22.783281+00:00 app[web.1]: return _ConnectionRecord(self)
2021-04-23T18:41:22.783282+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
2021-04-23T18:41:22.783282+00:00 app[web.1]: self.__connect(first_connect_check=True)
2021-04-23T18:41:22.783282+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 661, in __connect
2021-04-23T18:41:22.783282+00:00 app[web.1]: pool.logger.debug("Error on connect(): %s", e)
2021-04-23T18:41:22.783283+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
2021-04-23T18:41:22.783283+00:00 app[web.1]: compat.raise_(
2021-04-23T18:41:22.783283+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
2021-04-23T18:41:22.783283+00:00 app[web.1]: raise exception
2021-04-23T18:41:22.783284+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
2021-04-23T18:41:22.783284+00:00 app[web.1]: connection = pool._invoke_creator(self)
2021-04-23T18:41:22.783284+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
2021-04-23T18:41:22.783285+00:00 app[web.1]: return dialect.connect(*cargs, **cparams)
2021-04-23T18:41:22.783285+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 508, in connect
2021-04-23T18:41:22.783285+00:00 app[web.1]: return self.dbapi.connect(*cargs, **cparams)
2021-04-23T18:41:22.783285+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pymysql/__init__.py", line 94, in Connect
2021-04-23T18:41:22.783286+00:00 app[web.1]: return Connection(*args, **kwargs)
2021-04-23T18:41:22.783286+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pymysql/connections.py", line 327, in __init__
2021-04-23T18:41:22.783286+00:00 app[web.1]: self.connect()
2021-04-23T18:41:22.783287+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pymysql/connections.py", line 619, in connect
2021-04-23T18:41:22.783287+00:00 app[web.1]: raise exc
2021-04-23T18:41:22.783287+00:00 app[web.1]: sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on '153.121.51.117' (timed out)")
2021-04-23T18:41:22.783288+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/13/e3q8)
2021-04-23T18:41:22.784950+00:00 heroku[router]: at=info method=GET path="/league/1/" host=ponno.herokuapp.com request_id=fb7b0d8f-cb98-4214-8107-09e11fad9681 fwd="60.113.120.226" dyno=web.1 connect=0ms service=10739ms status=500 bytes=456 protocol=https
2021-04-23T18:41:22.785226+00:00 app[web.1]: 10.43.182.207 - spotto [24/ 4月/2021:03:41:22 +0900] "GET /league/1/ HTTP/1.1" 500 290 "https://ponno.herokuapp.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36"```
onopon commented 3 years ago

herokuから移行したことで解決。