Closed akors closed 2 years ago
There's a couple issues of users getting Can't connect to local MySQL server through socket
https://github.com/docker-library/mysql/issues/844, https://github.com/docker-library/mysql/issues/845
But I'm not able to reproduce the issue
$ docker run -d --name mysql -e MYSQL_RANDOM_ROOT_PASSWORD=1 mysql:5.7.38
0094f8c8cf85210f36dc70332ee9dfd7ea5ef7f3ccab86fd6ef882674680bd2f
$ docker logs mysql 2>&1 | grep -i generated
2022-05-27 16:15:31+00:00 [Note] [Entrypoint]: GENERATED ROOT PASSWORD: RSIGBdjF5W53dGJdMOu32HIWD8EisVGb
$ docker exec -it mysql mysql -pRSIGBdjF5W53dGJdMOu32HIWD8EisVGb
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.38 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
@wglambert
I can still completely reliably reproduce this 100% of the time. With 5.7.36 it starts, with 5.7.37 it crashes.
Looks like something happened between 5.7.36 and 5.7.37. What changed in this version?
What information do you need for debugging this issue?
It's the mysql_socket_fix
function for issue #829. If I comment out all invocations, startup works perfectly fine.
edit: to be more specific, it's this line: https://github.com/docker-library/mysql/blob/32aecb725b28afa043a5e879977a7947dfb64c14/5.7/docker-entrypoint.sh#L115
Since we can't reproduce, do you get any more interesting output if you remove the 2>/dev/null
from line 104? :bow:
(It would also be helpful to add set -x
to the script so we can see exactly what's running and where it's failing.)
Since we can't reproduce, do you get any more interesting output if you remove the 2>/dev/null from line 104? bow
This has no effect, output is not changed.
(It would also be helpful to add set -x to the script so we can see exactly what's running and where it's failing.)
+ _verboseHelpArgs=(--verbose --help --log-bin-index="$(mktemp -u)") ++ mktemp -u + _is_sourced + '[' 2 -ge 2 ']' + '[' _is_sourced = _is_sourced ']' + '[' main = source ']' + _main mysqld + '[' m = - ']' + '[' mysqld = mysqld ']' + _mysql_want_help mysqld + local arg + for arg in "$@" + case "$arg" in + return 1 + mysql_note 'Entrypoint script for MySQL Server 5.7.38-1debian10 started.' + mysql_log Note 'Entrypoint script for MySQL Server 5.7.38-1debian10 started.' + local type=Note + shift + local 'text=Entrypoint script for MySQL Server 5.7.38-1debian10 started.' + '[' 1 -eq 0 ']' + local dt ++ date --rfc-3339=seconds + dt='2022-05-27 21:55:05+00:00' + printf '%s [%s] [Entrypoint]: %s\n' '2022-05-27 21:55:05+00:00' Note 'Entrypoint script for MySQL Server 5.7.38-1debian10 started.' 2022-05-27 21:55:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.38-1debian10 started. + mysql_check_config mysqld + toRun=("$@" "${_verboseHelpArgs[@]}") + local toRun errors ++ mysqld --verbose --help --log-bin-index=/tmp/tmp.ph3MTtn9KZ + errors= + docker_setup_env mysqld + declare -g DATADIR SOCKET ++ mysql_get_config datadir mysqld ++ local conf=datadir ++ shift ++ mysqld --verbose --help --log-bin-index=/tmp/tmp.ph3MTtn9KZ ++ awk -v conf=datadir '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + DATADIR=/var/lib/mysql/ ++ mysql_get_config socket mysqld ++ local conf=socket ++ shift ++ mysqld --verbose --help --log-bin-index=/tmp/tmp.ph3MTtn9KZ ++ awk -v conf=socket '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + SOCKET=/var/run/mysqld/mysqld.sock + file_env MYSQL_ROOT_HOST % + local var=MYSQL_ROOT_HOST + local fileVar=MYSQL_ROOT_HOST_FILE + local def=% + '[' '' ']' + local val=% + '[' '' ']' + '[' '' ']' + export MYSQL_ROOT_HOST=% + MYSQL_ROOT_HOST=% + unset MYSQL_ROOT_HOST_FILE + file_env MYSQL_DATABASE + local var=MYSQL_DATABASE + local fileVar=MYSQL_DATABASE_FILE + local def= + '[' '' ']' + local val= + '[' '' ']' + '[' '' ']' + export MYSQL_DATABASE= + MYSQL_DATABASE= + unset MYSQL_DATABASE_FILE + file_env MYSQL_USER + local var=MYSQL_USER + local fileVar=MYSQL_USER_FILE + local def= + '[' '' ']' + local val= + '[' '' ']' + '[' '' ']' + export MYSQL_USER= + MYSQL_USER= + unset MYSQL_USER_FILE + file_env MYSQL_PASSWORD + local var=MYSQL_PASSWORD + local fileVar=MYSQL_PASSWORD_FILE + local def= + '[' '' ']' + local val= + '[' '' ']' + '[' '' ']' + export MYSQL_PASSWORD= + MYSQL_PASSWORD= + unset MYSQL_PASSWORD_FILE + file_env MYSQL_ROOT_PASSWORD + local var=MYSQL_ROOT_PASSWORD + local fileVar=MYSQL_ROOT_PASSWORD_FILE + local def=``` + '[' '' ']' + local val= + '[' '' ']' + '[' '' ']' + export MYSQL_ROOT_PASSWORD= + MYSQL_ROOT_PASSWORD= + unset MYSQL_ROOT_PASSWORD_FILE + declare -g DATABASE_ALREADY_EXISTS + '[' -d /var/lib/mysql//mysql ']' + docker_create_db_directories + local user ++ id -u + user=0 + mkdir -p /var/lib/mysql/ + '[' 0 = 0 ']' + find /var/lib/mysql/ '!' -user mysql -exec chown --no-dereference mysql '{}' + ++ id -u + '[' 0 = 0 ']' + mysql_note 'Switching to dedicated user '\''mysql'\''' + mysql_log Note 'Switching to dedicated user '\''mysql'\''' + local type=Note + shift + local 'text=Switching to dedicated user '\''mysql'\''' + '[' 1 -eq 0 ']' + local dt ++ date --rfc-3339=seconds + dt='2022-05-27 21:55:27+00:00' + printf '%s [%s] [Entrypoint]: %s\n' '2022-05-27 21:55:27+00:00' Note 'Switching to dedicated user '\''mysql'\''' + exec gosu mysql /usr/local/bin/docker-entrypoint.sh mysqld 2022-05-27 21:55:27+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' + _verboseHelpArgs=(--verbose --help --log-bin-index="$(mktemp -u)") ++ mktemp -u + _is_sourced + '[' 2 -ge 2 ']' + '[' _is_sourced = _is_sourced ']' + '[' main = source ']' + _main mysqld + '[' m = - ']' + '[' mysqld = mysqld ']' + _mysql_want_help mysqld + local arg + for arg in "$@" + case "$arg" in + return 1 + mysql_note 'Entrypoint script for MySQL Server 5.7.38-1debian10 started.' + mysql_log Note 'Entrypoint script for MySQL Server 5.7.38-1debian10 started.' + local type=Note + shift + local 'text=Entrypoint script for MySQL Server 5.7.38-1debian10 started.' + '[' 1 -eq 0 ']' + local dt ++ date --rfc-3339=seconds + dt='2022-05-27 21:55:27+00:00' + printf '%s [%s] [Entrypoint]: %s\n' '2022-05-27 21:55:27+00:00' Note 'Entrypoint script for MySQL Server 5.7.38-1debian10 started.' 2022-05-27 21:55:27+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.38-1debian10 started. + mysql_check_config mysqld + toRun=("$@" "${_verboseHelpArgs[@]}") + local toRun errors ++ mysqld --verbose --help --log-bin-index=/tmp/tmp.z8ILnx7S1C + errors= + docker_setup_env mysqld + declare -g DATADIR SOCKET ++ mysql_get_config datadir mysqld ++ local conf=datadir ++ shift ++ mysqld --verbose --help --log-bin-index=/tmp/tmp.z8ILnx7S1C ++ awk -v conf=datadir '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + DATADIR=/var/lib/mysql/ ++ mysql_get_config socket mysqld ++ local conf=socket ++ shift ++ mysqld --verbose --help --log-bin-index=/tmp/tmp.z8ILnx7S1C ++ awk -v conf=socket '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + SOCKET=/var/run/mysqld/mysqld.sock + file_env MYSQL_ROOT_HOST % + local var=MYSQL_ROOT_HOST + local fileVar=MYSQL_ROOT_HOST_FILE + local def=% + '[' % ']' + '[' '' ']' + local val=% + '[' % ']' + val=% + export MYSQL_ROOT_HOST=% + MYSQL_ROOT_HOST=% + unset MYSQL_ROOT_HOST_FILE + file_env MYSQL_DATABASE + local var=MYSQL_DATABASE + local fileVar=MYSQL_DATABASE_FILE + local def= + '[' '' ']' + local val= + '[' '' ']' + '[' '' ']' + export MYSQL_DATABASE= + MYSQL_DATABASE= + unset MYSQL_DATABASE_FILE + file_env MYSQL_USER + local var=MYSQL_USER + local fileVar=MYSQL_USER_FILE + local def= + '[' '' ']' + local val= + '[' '' ']' + '[' '' ']' + export MYSQL_USER= + MYSQL_USER= + unset MYSQL_USER_FILE + file_env MYSQL_PASSWORD + local var=MYSQL_PASSWORD + local fileVar=MYSQL_PASSWORD_FILE + local def= + '[' '' ']' + local val= + '[' '' ']' + '[' '' ']' + export MYSQL_PASSWORD= + MYSQL_PASSWORD= + unset MYSQL_PASSWORD_FILE + file_env MYSQL_ROOT_PASSWORD + local var=MYSQL_ROOT_PASSWORD + local fileVar=MYSQL_ROOT_PASSWORD_FILE + local def= + '[' '' ']' + local val= + '[' '' ']' + '[' '' ']' + export MYSQL_ROOT_PASSWORD= + MYSQL_ROOT_PASSWORD= + unset MYSQL_ROOT_PASSWORD_FILE + declare -g DATABASE_ALREADY_EXISTS + '[' -d /var/lib/mysql//mysql ']' + docker_create_db_directories + local user ++ id -u + user=999 + mkdir -p /var/lib/mysql/ + '[' 999 = 0 ']' ++ id -u + '[' 999 = 0 ']' + '[' -z '' ']' + docker_verify_minimum_env + '[' -z '' -a -z '' -a -z 1 ']' + '[' '' = root ']' + '[' -n '' ']' + '[' -z '' ']' + '[' -n '' ']' + ls /docker-entrypoint-initdb.d/ + docker_init_database_dir mysqld + mysql_note 'Initializing database files' + mysql_log Note 'Initializing database files' + local type=Note + shift + local 'text=Initializing database files' + '[' 1 -eq 0 ']' + local dt ++ date --rfc-3339=seconds + dt='2022-05-27 21:55:49+00:00' + printf '%s [%s] [Entrypoint]: %s\n' '2022-05-27 21:55:49+00:00' Note 'Initializing database files' + mysqld --initialize-insecure --default-time-zone=SYSTEM 2022-05-27 21:55:49+00:00 [Note] [Entrypoint]: Initializing database files 2022-05-27T21:55:55.902074Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2022-05-27T21:55:56.037090Z 0 [Warning] InnoDB: New log files created, LSN=45790 2022-05-27T21:55:56.060432Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2022-05-27T21:55:56.116448Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c911c1b7-de07-11ec-9b25-0242ac110002. 2022-05-27T21:55:56.117956Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2022-05-27T21:55:56.524786Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. 2022-05-27T21:55:56.524799Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. 2022-05-27T21:55:56.525179Z 0 [Warning] CA certificate ca.pem is self signed. 2022-05-27T21:55:56.657163Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. + mysql_note 'Database files initialized' + mysql_log Note 'Database files initialized' + local type=Note + shift + local 'text=Database files initialized' + '[' 1 -eq 0 ']' + local dt ++ date --rfc-3339=seconds 2022-05-27 21:55:59+00:00 [Note] [Entrypoint]: Database files initialized + dt='2022-05-27 21:55:59+00:00' + printf '%s [%s] [Entrypoint]: %s\n' '2022-05-27 21:55:59+00:00' Note 'Database files initialized' + mysql_note 'Starting temporary server' + mysql_log Note 'Starting temporary server' + local type=Note + shift + local 'text=Starting temporary server' + '[' 1 -eq 0 ']' + local dt ++ date --rfc-3339=seconds 2022-05-27 21:55:59+00:00 [Note] [Entrypoint]: Starting temporary server + dt='2022-05-27 21:55:59+00:00' + printf '%s [%s] [Entrypoint]: %s\n' '2022-05-27 21:55:59+00:00' Note 'Starting temporary server' + docker_temp_server_start mysqld + '[' 5.7 = 5.7 ']' + mysql_note 'Waiting for server startup' + mysql_log Note 'Waiting for server startup' + local type=Note + shift + local 'text=Waiting for server startup' + mysqld --skip-networking --default-time-zone=SYSTEM --socket=/var/run/mysqld/mysqld.sock + '[' 1 -eq 0 ']' + local dt ++ date --rfc-3339=seconds + dt='2022-05-27 21:55:59+00:00' + printf '%s [%s] [Entrypoint]: %s\n' '2022-05-27 21:55:59+00:00' Note 'Waiting for server startup' 2022-05-27 21:55:59+00:00 [Note] [Entrypoint]: Waiting for server startup + local i + for i in {30..0} + extraArgs=() + '[' -z '' ']' + extraArgs+=('--dont-use-mysql-root-password') + docker_process_sql --dont-use-mysql-root-password --database=mysql + sleep 1 + for i in {30..0} + extraArgs=() + '[' -z '' ']' + extraArgs+=('--dont-use-mysql-root-password') + docker_process_sql --dont-use-mysql-root-password --database=mysql + sleep 1 + for i in {30..0} + extraArgs=() + '[' -z '' ']' + extraArgs+=('--dont-use-mysql-root-password') + docker_process_sql --dont-use-mysql-root-password --database=mysql + sleep 1 + for i in {30..0} + extraArgs=() + '[' -z '' ']' + extraArgs+=('--dont-use-mysql-root-password') + docker_process_sql --dont-use-mysql-root-password --database=mysql + sleep 1 + for i in {30..0} + extraArgs=() + '[' -z '' ']' + extraArgs+=('--dont-use-mysql-root-password') + docker_process_sql --dont-use-mysql-root-password --database=mysql + sleep 1 + for i in {30..0} + extraArgs=() + '[' -z '' ']' + extraArgs+=('--dont-use-mysql-root-password') + docker_process_sql --dont-use-mysql-root-password --database=mysql + sleep 1 + for i in {30..0} + extraArgs=() + '[' -z '' ']' + extraArgs+=('--dont-use-mysql-root-password') + docker_process_sql --dont-use-mysql-root-password --database=mysql + sleep 1 2022-05-27T21:56:06.596425Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2022-05-27T21:56:06.598279Z 0 [Note] mysqld (mysqld 5.7.38) starting as process 77 ... 2022-05-27T21:56:06.603795Z 0 [Note] InnoDB: PUNCH HOLE support available 2022-05-27T21:56:06.603825Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2022-05-27T21:56:06.603828Z 0 [Note] InnoDB: Uses event mutexes 2022-05-27T21:56:06.603830Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2022-05-27T21:56:06.603832Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2022-05-27T21:56:06.603833Z 0 [Note] InnoDB: Using Linux native AIO 2022-05-27T21:56:06.604052Z 0 [Note] InnoDB: Number of pools: 1 2022-05-27T21:56:06.604150Z 0 [Note] InnoDB: Using CPU crc32 instructions 2022-05-27T21:56:06.605675Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2022-05-27T21:56:06.614045Z 0 [Note] InnoDB: Completed initialization of buffer pool 2022-05-27T21:56:06.616494Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 2022-05-27T21:56:06.632121Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2022-05-27T21:56:06.641813Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2022-05-27T21:56:06.641885Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2022-05-27T21:56:06.655601Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 2022-05-27T21:56:06.656282Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2022-05-27T21:56:06.656292Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2022-05-27T21:56:06.656712Z 0 [Note] InnoDB: Waiting for purge to start 2022-05-27T21:56:06.706873Z 0 [Note] InnoDB: 5.7.38 started; log sequence number 2749976 2022-05-27T21:56:06.707033Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 2022-05-27T21:56:06.707140Z 0 [Note] Plugin 'FEDERATED' is disabled. 2022-05-27T21:56:06.711911Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220527 21:56:06 2022-05-27T21:56:06.713782Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. 2022-05-27T21:56:06.713791Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. 2022-05-27T21:56:06.713793Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. 2022-05-27T21:56:06.713794Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. 2022-05-27T21:56:06.714228Z 0 [Warning] CA certificate ca.pem is self signed. 2022-05-27T21:56:06.714250Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory. 2022-05-27T21:56:06.715851Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2022-05-27T21:56:06.736498Z 0 [Note] Event Scheduler: Loaded 0 events 2022-05-27T21:56:06.736628Z 0 [Note] mysqld: ready for connections. Version: '5.7.38' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL) + for i in {30..0} + extraArgs=() + '[' -z '' ']' + extraArgs+=('--dont-use-mysql-root-password') + docker_process_sql --dont-use-mysql-root-password --database=mysql + break + '[' 23 = 0 ']' + mysql_note 'Temporary server started.' + mysql_log Note 'Temporary server started.' + local type=Note + shift + local 'text=Temporary server started.' + '[' 1 -eq 0 ']' + local dt ++ date --rfc-3339=seconds + dt='2022-05-27 21:56:07+00:00' + printf '%s [%s] [Entrypoint]: %s\n' '2022-05-27 21:56:07+00:00' Note 'Temporary server started.' 2022-05-27 21:56:07+00:00 [Note] [Entrypoint]: Temporary server started. + mysql_socket_fix + local defaultSocket ++ mysql_get_config socket mysqld --no-defaults ++ local conf=socket ++ shift ++ mysqld --no-defaults --verbose --help --log-bin-index=/tmp/tmp.z8ILnx7S1C ++ awk -v conf=socket '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + defaultSocket=/var/run/mysqld/mysqld.sock + '[' /var/run/mysqld/mysqld.sock '!=' /var/run/mysqld/mysqld.sock ']' + docker_setup_db + '[' -z '' ']' + mysql_tzinfo_to_sql /usr/share/zoneinfo + sed 's/Local time zone must be set--see zic manual page/FCTY/' + docker_process_sql --dont-use-mysql-root-password --database=mysql + passfileArgs=() + '[' --dont-use-mysql-root-password = --dont-use-mysql-root-password ']' + passfileArgs+=("$1") + shift + '[' -n '' ']' + mysql --defaults-extra-file=/dev/fd/63 --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock --comments --database=mysql ++ _mysql_passfile --dont-use-mysql-root-password ++ '[' --dont-use-mysql-root-password '!=' --dont-use-mysql-root-password ']' ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
I have now discovered that it is actually a memory issue and the process is killed by OOMkiller.
Watching with while true ; do docker top priceless_chaplygin axk comm o pid,pcpu,pmem,rss,args ; sleep 0.2 ; done
this command quickly consumes most of my 16GB memory: mysqld --verbose --help --log-bin-index=/tmp/tmp.bHB5qiQI0X
. Memory balloons up and then dies down again during script execution.
Here are the last readings of the output:
PID %CPU %MEM RSS COMMAND
38218 0.0 0.0 2276 /bin/bash /usr/local/bin/docker-entrypoint.sh mysqld
41844 91.3 85.2 13667636 mysqld --skip-networking --default-time-zone=SYSTEM --socket=/var/run/mysqld/mysqld.sock
42298 0.0 0.0 688 sleep 1
PID %CPU %MEM RSS COMMAND
38218 0.0 0.0 2276 /bin/bash /usr/local/bin/docker-entrypoint.sh mysqld
41844 95.3 85.3 13674808 mysqld --skip-networking --default-time-zone=SYSTEM --socket=/var/run/mysqld/mysqld.sock
42298 0.0 0.0 688 sleep 1
PID %CPU %MEM RSS COMMAND
38218 0.0 0.0 2280 /bin/bash /usr/local/bin/docker-entrypoint.sh mysqld
41844 99.3 85.3 13681412 mysqld --skip-networking --default-time-zone=SYSTEM --socket=/var/run/mysqld/mysqld.sock
42371 0.0 0.0 684 sleep 1
PID %CPU %MEM RSS COMMAND
38218 0.0 0.0 2280 /bin/bash /usr/local/bin/docker-entrypoint.sh mysqld
41844 103 85.5 13708304 mysqld --skip-networking --default-time-zone=SYSTEM --socket=/var/run/mysqld/mysqld.sock
42371 0.0 0.0 684 sleep 1
PID %CPU %MEM RSS COMMAND
38218 0.0 0.0 2280 /bin/bash /usr/local/bin/docker-entrypoint.sh mysqld
41844 92.5 85.7 13739632 mysqld --skip-networking --default-time-zone=SYSTEM --socket=/var/run/mysqld/mysqld.sock
42371 0.0 0.0 684 sleep 1
PID %CPU %MEM RSS COMMAND
38218 0.0 0.0 2280 /bin/bash /usr/local/bin/docker-entrypoint.sh mysqld
41844 95.8 85.4 13691280 mysqld --skip-networking --default-time-zone=SYSTEM --socket=/var/run/mysqld/mysqld.sock
42371 0.0 0.0 684 sleep 1
Weirdly enough, when commenting out mysql_socket_fix
calls, the memory ballooning still happens, but it is not killed and completes correctly. Note that the newest script mounted into the 5.7.36 mysql image also crashes.
BTW is it possible that you are on MacOS? I'm on Fedora 35 with Kernel 5.17.9-200.fc35.x86_64
From your ps
output, it's the temporary mysqld
server, not the --verbose --help
that's eating all memory and dying. :grimacing:
We typically use pure Linux (specifically Debian with a 5.x kernel).
From the output you've shared, the place the server is dying is in the following block:
So it starts mysqld
in the background, then loops to wait for it to be started and working -- what I'm not clear on is why it might be ballooning there with nothing but repeated attempts to SELECT 1
(which are apparently failing in some way) -- it would probably be useful to remove &> /dev/null
there and see what error those mysql
invocations are getting.
Another thing to try would be attaching strace
in another terminal to the mysqld
instance once it's started to see if maybe there's some repeated failure there that could give a clue as to why it's ballooning.
(I think the fact that commenting out mysql_socket_fix
makes it work is a red herring and there's gotta be something deeper going on here, especially since from the output you shared, that function is literally doing nothing :grimacing:)
It sounds like a duplicate of https://github.com/docker-library/mysql/issues/840 and so likely caused by https://github.com/containerd/containerd/issues/6707
It sounds like a duplicate of https://github.com/docker-library/mysql/issues/840 and so likely caused by https://github.com/containerd/containerd/issues/6707
Thanks for this. You are probably right, because the LimitNOFILE workaround from that containerd issue also works for me. I'm also on Fedora 35 just like the commenters there.
Nice, glad we got it figured out! :+1:
(Going to close as I don't think there's anything more we can do here :see_no_evil:)
The latest build of the image crashes when initializing a new database if
MYSQL_RANDOM_ROOT_PASSWORD
was set.Run the following command:
Observe the following error message:
Note that this DOES occur with the label
5.7.38
, but it does NOT occur with5.7.28
. Something must've gone wrong in the last update.This works just fine:
Docker version:
Full log: