Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorry, unexpected error: (_mysql_exceptions.OperationalError) (2006, 'MySQL server has gone away') #146

Closed
gouyeh opened this issue Apr 7, 2019 · 4 comments

Comments

@gouyeh
Copy link

gouyeh commented Apr 7, 2019

Some times website loaded successfully without errors sometimes giving this error again and again.
Using Centos7, Vestacp with nginx+apache and mariadb.
Please help me out.

[2019-04-07 22:47:29,376] {/var/www/get5-web/venv/lib/python2.7/site-packages/flask/app.py:1423} ERROR - Exception on / [GET] Traceback (most recent call last): File "/var/www/get5-web/venv/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/var/www/get5-web/venv/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/var/www/get5-web/venv/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/var/www/get5-web/venv/lib/python2.7/site-packages/flask/app.py", line 1473, in full_dispatch_request rv = self.preprocess_request() File "/var/www/get5-web/venv/lib/python2.7/site-packages/flask/app.py", line 1666, in preprocess_request rv = func() File "/var/www/get5-web/get5/__init__.py", line 163, in before_request g.user = User.query.get(session['user_id']) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 831, in get return self._get_impl(ident, loading.load_on_ident) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 864, in _get_impl return fallback_fn(self, key) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 219, in load_on_ident return q.one() File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2718, in one ret = list(self) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2761, in __iter__ return self._execute_and_instances(context) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2776, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement compiled_sql, distilled_params File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context context) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception exc_info File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context context) File "/var/www/get5-web/venv/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters) File "/var/www/get5-web/venv/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute self.errorhandler(self, exc, value) File "/var/www/get5-web/venv/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 user.id AS user_id, user.steam_id AS user_steam_id, user.name AS user_name, user.admin AS user_admin \nFROM user \nWHERE user.id $ [2019-04-07 22:47:29,385] {/var/www/get5-web/get5/__init__.py:155} ERROR - (_mysql_exceptions.OperationalError) (2006, 'MySQL server has gone away') [SQL: u'SELECT user.id AS user_id, user.steam_id AS user_steam_id$

@gouyeh
Copy link
Author

gouyeh commented Apr 7, 2019

If client add a new csgo server with 27080 port to my get5 web panel he is facing this error failed to connect server if i add that same port 27080 to my server iptables rules, which is hosting get5 web panel then client can add that server.

So my question is very simple. Every port of my server should be opened?

@PhlexPlexico
Copy link

It seems your MariaDB is running into issues connecting from an external source. This could be for a few reasons, but after some quick googling it seems that it could possibly be a max packet issue in your MariaDB setup. This could be do to the timeout, as well. First, it would be best to try changing the timeout in your database? See here for more info on some things related to MariaDB and connections that I stumbled across.

@gouyeh
Copy link
Author

gouyeh commented Apr 8, 2019

Thanks PhlexPlexico for you best answer, Actually after posting this issue i was trying to find solution on google for this issue and i already found this same answer from here it fixed my issue thanks.

It seems your MariaDB is running into issues connecting from an external source. This could be for a few reasons, but after some quick googling it seems that it could possibly be a max packet issue in your MariaDB setup. This could be do to the timeout, as well. First, it would be best to try changing the timeout in your database? See here for more info on some things related to MariaDB and connections that I stumbled across.

Will you have any info about this issue?

If client add a new csgo server with 27080 port to my get5 web panel he is facing this error failed to connect server if i add that same port 27080 to my server iptables rules, which is hosting get5 web panel then client can add that server.

So my question is very simple. Every port of my server should be opened?

@PhlexPlexico
Copy link

Hey! Anytime! Aside from the server having every port open, that is a definite no as it can cause a bunch of security issues. I'm running my instance of get5-web on a docker container which is behind a firewall that is rather restrictive. What I would recommend first is try opening your database port (I believe MySQL, and by extension MariaDB is 3306) should try to be opened. If that changes nothing, then close it.

Most servers for CSGO will operate in the 27000-27999 range, from what I've witnessed. You could even open a subset of that, just to be safe. Since CSGOs defaults are 27015 and 27020 for server + gotv, I'd say try opening 27000-27199. That should give more than enough room for growth if you expect to add lots of servers. If not, make it even smaller. 27000-27100.

I'm definitely not an expert at setting up servers, and am completely unsure why the user is having an issue with this, but have they tried adding a different server? If someone could correct me, if this is not the way to go at it, that would he wonderful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants