Welcome to World of IPTV

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Forum Rules

Our Rules: Read to avoid getting banned!

Advertising

Introduce Yourself to the World with Us!

Resource Database

Find the newest resources around IPTV!

Account upgrade

Upgrade your account to unlock more benefits!

Tutorial How to Resolve "MySQL Server Has Gone Away" Errors in XUI-One Panel

redhat

Administrator
Staff member
Administrator
Joined
Jun 19, 2019
Messages
3,467
Reaction score
17,063
Points
134
Location
root[@]woi

How to Resolve "MySQL Server Has Gone Away" Errors in XUI-One Panel​


This guide explains how to resolve the error:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

commonly seen in XUI-One IPTV panels during EPG imports or channel updates.

The fix is to adjust configuration on:

  • MariaDB server (Main Server, e.g. MAIN_DB_IP)
  • XUI-One PHP stack (LB Live, e.g. LB_LIVE_IP)

1. Tune MariaDB on Main Server (MAIN_DB_IP)​


Active MariaDB config file:

/etc/mysql/mariadb.cnf

1.1 Edit MariaDB settings​


Open the file:

Bash:
nano /etc/mysql/mariadb.cnf

In the [mysqld] section, ensure the following values are set.
Adjust existing entries so they match:

INI:
[mysqld]
# XUI / MariaDB base settings
user                            = mysql
port                            = 3306
basedir                         = /usr
datadir                         = /var/lib/mysql
tmpdir                          = /tmp
lc-messages-dir                 = /usr/share/mysql
skip-external-locking
skip-name-resolve
bind-address                    = *

# Connections
max_connections                 = 200
back_log                        = 256
max_connect_errors              = 1000

# Packet and cache
max_allowed_packet              = 256M
open_files_limit                = 2048
innodb_open_files               = 1024
table_open_cache                = 1024
table_definition_cache          = 1024

# XUI timeouts
wait_timeout                    = 28800
interactive_timeout             = 28800
connect_timeout                 = 30

# Temp tables
tmp_table_size                  = 64M
max_heap_table_size             = 64M

# InnoDB
innodb_buffer_pool_size         = 2G
innodb_buffer_pool_instances    = 1
innodb_read_io_threads          = 4
innodb_write_io_threads         = 4
innodb_thread_concurrency       = 8
innodb_flush_log_at_trx_commit  = 1
innodb_flush_method             = O_DIRECT
innodb_file_per_table           = 1
innodb_io_capacity              = 1000
innodb_table_locks              = 1
innodb_lock_wait_timeout        = 30

# Logging
expire_logs_days                = 7
max_binlog_size                 = 64M

# Query cache – disabled
query_cache_limit               = 0
query_cache_size                = 0
query_cache_type                = 0

performance_schema              = 0

sql_mode                        = "NO_ENGINE_SUBSTITUTION"

Also update the `[mysqldump]` section for consistency:

INI:
[mysqldump]
quick
quote-names
max_allowed_packet              = 256M

1.2 Restart MariaDB and verify settings​


Restart the service:

Bash:
systemctl restart mariadb
systemctl status mariadb

Verify the important variables:

Bash:
mysql -u root -p -e "SHOW VARIABLES WHERE Variable_name IN ('max_allowed_packet','wait_timeout','interactive_timeout','connect_timeout');"

Expected values:

  • max_allowed_packet = 268435456 (256M)
  • wait_timeout = 28800
  • interactive_timeout = 28800
  • connect_timeout = 30

2. Tune XUI-One PHP on LB Live (LB_LIVE_IP)​


XUI-One uses its own bundled PHP installation.

2.1 Edit XUI-One php.ini​


XUI PHP config file:

/home/xui/bin/php/lib/php.ini

Open and edit:

Bash:
nano /home/xui/bin/php/lib/php.ini

Set or adjust these directives (ensure these are the final values in the file):

INI:
max_execution_time = 300
memory_limit       = 1024M
default_socket_timeout = 300

2.2 Restart XUI-One services​


Restart the bundled PHP-FPM / web stack (command may vary depending on your setup). Typical examples:

Bash:
service xuione restart

Check that XUI and PHP-FPM are running without errors.

3. Testing and Monitoring​


3.1 Reproduce the previous error​


From the XUI-One panel:

  • Run the operation that previously caused the error (e.g. EPG import, bulk channel update).

3.2 Monitor MariaDB logs on Main Server​


Use journalctl (or your error log file if configured):

Bash:
journalctl -u mariadb --since "10 minutes ago" | tail -n 50

You should see significantly fewer (or no) warnings like:

Aborted connection ... (Got an error reading communication packets)

3.3 Monitor XUI / PHP logs on LB Live​


XUI log locations:

  • /home/xui/bin/php/var/log/php-fpm.log
  • /home/xui/bin/nginx/logs/error.log

Check for any PHP fatal errors or timeouts:

Bash:
tail -n 50 /home/xui/bin/php/var/log/php-fpm.log
tail -n 50 /home/xui/bin/nginx/logs/error.log

4. Result​


By:

  • Increasing max_allowed_packet to 256M and raising MariaDB connection timeouts on the Main Server, and
  • Increasing PHP execution and socket timeouts in XUI-One’s bundled PHP on LB Live,

the "MySQL server has gone away" / SQLSTATE[HY000]: 2006 errors during heavy operations (EPG imports, channel updates, etc.) should be resolved or drastically reduced.
 
On my xui one sometime suddently connection goes back to zero and load balacer get unreachable will this help with this issue?

Looking forward to your reply
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top