[CONC-502] "Got packets out of order" when trying to connect to mysql-8.0.21 server with auth_socket Created: 2020-09-24  Updated: 2020-09-25  Resolved: 2020-09-25

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.1.10
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Daniel Black Assignee: Georg Richter
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

 
build-mariadb-server-10.2]$ client/mysqldump -S /tmp/mysql8.0.sock --system=all
mysqldump: Got error: 1156: "Got packets out of order" when trying to connect
 
build-mariadb-server-10.5]$ client/mariadb -S /tmp/mysql8.0.sock
ERROR 1156 (08S01): Got packets out of order

create user 8.0.21

CREATE USER 'dan'@'localhost' IDENTIFIED WITH 'auth_socket'



 Comments   
Comment by Georg Richter [ 2020-09-24 ]

Daniel, I can't repeat this issue:

./mysqldump -S /home/georg/work/mysql/mysql-server/bld/mysql-test/var/tmp/mysqld.1.sock  test
-- MySQL dump 10.16  Distrib 10.2.34-MariaDB, for Linux (x86_64)
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version       8.0.21
.....

What is the last revision in 10.2/libmariadb ?

Comment by Daniel Black [ 2020-09-24 ]

a746c3af449a8754e78ad7971e59e79af7957cdb (HEAD, tag: v3.1.9)

So this is a auth_socket authentication plugin user on the server side?

Comment by Georg Richter [ 2020-09-24 ]

So revision should be ok - we fixed that in CONC-469

georg@beethoven:~/work/mariadb/server/bld/client$ ./mysql -S /home/georg/work/mysql/mysql-server/bld/mysql-test/var/tmp/mysqld.1.sock  test -e"show create user georg@localhost\G"
*************************** 1. row ***************************
CREATE USER for georg@localhost: CREATE USER 'georg'@'localhost' IDENTIFIED WITH 'auth_socket' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT
 
georg@beethoven:~/work/mariadb/server/bld/client$ ./mysql -S /home/georg/work/mysql/mysql-server/bld/mysql-test/var/tmp/mysqld.1.sock  test -e"select current_user()\G"
*************************** 1. row ***************************
current_user(): georg@localhost
georg@beethoven:~/work/mariadb/server/bld/client$ ./mysql -S /home/georg/work/mysql/mysql-server/bld/mysql-test/var/tmp/mysqld.1.sock  test -e"select version()\G"
*************************** 1. row ***************************
version(): 8.0.21

Comment by Georg Richter [ 2020-09-24 ]

Daniel: Do you have any auth plugin related settings in client section of your configuration file?

Comment by Daniel Black [ 2020-09-24 ]

None, was using tests too:

Just pulled the latest 10.5

strace of client -10.5-1adb5378060

build-mariadb-server-10.5]$ strace -s 200 -e trace=network client/mariadb  --no-defaults -u dan -S /tmp/mysql8.0.sock
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM, 0)         = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0
sendto(3, "\24\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0", 16, MSG_NOSIGNAL, NULL, 0) = 16
sendto(3, "\1\0\0\0", 4, MSG_NOSIGNAL, NULL, 0) = 4
sendto(3, "\32\0\0\0\241\0\0\0\0\0\0\0\0\0\0\0", 16, MSG_NOSIGNAL, NULL, 0) = 16
sendto(3, "mysql\0tcp\0", 10, MSG_NOSIGNAL, NULL, 0) = 10
socket(AF_UNIX, SOCK_STREAM, 0)         = 4
connect(4, {sa_family=AF_UNIX, sun_path="/tmp/mysql8.0.sock"}, 110) = 0
setsockopt(4, SOL_IP, IP_TOS, [8], 4)   = -1 EOPNOTSUPP (Operation not supported)
setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
recvfrom(4, 0x55687a3f3240, 16384, MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(4, "J\0\0\0\n8.0.21\0!\0\0\0\177;\1\27)Qy\7\0\377\377\377\2\0\377\307\25\0\0\0\0\0\0\0\0\0\0\4kJ\25@v\tH\fs*\36\0caching_sha2_password\0", 16384, MSG_DONTWAIT, NULL, NULL) = 78
sendto(4, "\242\0\0\1\205\246\337 \0\0\0\1!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dan\0\0dummy_fallback_auth\0h\3_os\5Linux\f_client_name\nlibmariadb\4_pid\6920451\17_client_version\0053.1.9\t_platform\6x86_64\fprogram_name\5mysql", 166, MSG_DONTWAIT|MSG_NOSIGNAL, NULL, 0) = 166
recvfrom(4, 0x55687a3f3240, 16384, MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(4, "\7\0\0\2\0\0\0\2\0\0\0", 16384, MSG_DONTWAIT, NULL, NULL) = 11
sendto(4, "\0\0\0\3", 4, MSG_DONTWAIT|MSG_NOSIGNAL, NULL, 0) = 4
recvfrom(4, 0x55687a3f3240, 16384, MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(4, "!\0\0\0\377\204\4#08S01Got packets out of order", 16384, MSG_DONTWAIT, NULL, NULL) = 37
ERROR 1156 (08S01): Got packets out of order
+++ exited with 1 +++

10.5-head-cc-ee2216aa3f36d9a8472dfa9397a39a88dfb1256c

$ strace -s 200 -e trace=network client/mariadb  --no-defaults -u dan -S /tmp/mysql8.0.sock
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM, 0)         = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0
sendto(3, "\24\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0", 16, MSG_NOSIGNAL, NULL, 0) = 16
sendto(3, "\1\0\0\0", 4, MSG_NOSIGNAL, NULL, 0) = 4
sendto(3, "\32\0\0\0\241\0\0\0\0\0\0\0\0\0\0\0", 16, MSG_NOSIGNAL, NULL, 0) = 16
sendto(3, "mysql\0tcp\0", 10, MSG_NOSIGNAL, NULL, 0) = 10
socket(AF_UNIX, SOCK_STREAM, 0)         = 4
connect(4, {sa_family=AF_UNIX, sun_path="/tmp/mysql8.0.sock"}, 110) = 0
setsockopt(4, SOL_IP, IP_TOS, [8], 4)   = -1 EOPNOTSUPP (Operation not supported)
setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
recvfrom(4, 0x557ee6d8e240, 16384, MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(4, "J\0\0\0\n8.0.21\0\"\0\0\0#_\20\0327Y/8\0\377\377\377\2\0\377\307\25\0\0\0\0\0\0\0\0\0\0Sm@\32+\3\35J\16\0244c\0caching_sha2_password\0", 16384, MSG_DONTWAIT, NULL, NULL) = 78
sendto(4, "\243\0\0\1\205\246\337 \0\0\0\1!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dan\0\0dummy_fallback_auth\0i\3_os\5Linux\f_client_name\nlibmariadb\4_pid\6921452\17_client_version\0063.1.11\t_platform\6x86_64\fprogram_name\5mysql", 167, MSG_DONTWAIT|MSG_NOSIGNAL, NULL, 0) = 167
recvfrom(4, 0x557ee6d8e240, 16384, MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(4, "\7\0\0\2\0\0\0\2\0\0\0", 16384, MSG_DONTWAIT, NULL, NULL) = 11
sendto(4, "\0\0\0\3", 4, MSG_DONTWAIT|MSG_NOSIGNAL, NULL, 0) = 4
recvfrom(4, 0x557ee6d8e240, 16384, MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(4, "!\0\0\0\377\204\4#08S01Got packets out of order", 16384, MSG_DONTWAIT, NULL, NULL) = 37
ERROR 1156 (08S01): Got packets out of order
+++ exited with 1 +++

mysql-8.0.21 server

/usr/local/mysql-8.0.21/bin/mysqld --no-defaults --basedir=/usr/local/mysql-8.0.21/ --datadir=/usr/local/mysql-8.0.21/data --socket=/tmp/mysql8.0.sock --skip-networking
 
mysql> pager grep auth_socket
PAGER set to 'grep auth_socket'
mysql> show plugins
    -> ;
| auth_socket                     | ACTIVE   | AUTHENTICATION     | auth_socket.so | GPL     |
45 rows in set (0.03 sec)
 
mysql> pager
Default pager wasn't set, using stdout.
mysql> select @@plugin_dir;
+-------------------------------------+
| @@plugin_dir                        |
+-------------------------------------+
| /usr/local/mysql-8.0.21/lib/plugin/ |
+-------------------------------------+
1 row in set (0.02 sec)
 
mysql> show create user dan@localhost\G
*************************** 1. row ***************************
CREATE USER for dan@localhost: CREATE USER 'dan'@'localhost' IDENTIFIED WITH 'auth_socket' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT
1 row in set (0.00 sec)

Same results with mysqld without --skip-networking.

So i've used the binary tarball of mysql-8.0.21.

locally built mysql-8.0.21 has same results

 build-mysql-server-8.0]$ runtime_output_directory/mysqld --no-defaults --datadir=/usr/local/mysql-8.0.21/data --socket=/tmp/mysql8.0.sock --skip-networking --plugin-dir=./plugin_output_directory/

mysql-8.0.21 client

 $ strace -s 200 -fe trace=network /usr/local/mysql-8.0.21/bin/mysql --no-defaults  --socket=/tmp/mysql8.0.sock
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4
connect(4, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4
connect(4, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM, 0)         = 4
connect(4, {sa_family=AF_UNIX, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0
sendto(4, "\24\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0", 16, MSG_NOSIGNAL, NULL, 0) = 16
sendto(4, "\1\0\0\0", 4, MSG_NOSIGNAL, NULL, 0) = 4
sendto(4, "\32\0\0\0\241\0\0\0\0\0\0\0\0\0\0\0", 16, MSG_NOSIGNAL, NULL, 0) = 16
sendto(4, "mysql\0tcp\0", 10, MSG_NOSIGNAL, NULL, 0) = 10
socket(AF_UNIX, SOCK_STREAM, 0)         = 5
connect(5, {sa_family=AF_UNIX, sun_path="/tmp/mysql8.0.sock"}, 110) = 0
setsockopt(5, SOL_TCP, TCP_NODELAY, [1], 4) = -1 EOPNOTSUPP (Operation not supported)
setsockopt(5, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
recvfrom(5, "J\0\0\0\n8.0.21\0\n\0\0\0001\37\4)&-%V\0\377\377\377\2\0\377\307\25\0\0\0\0\0\0\0\0\0\0\\blQC\2\6\2\21&m\1\0caching_sha2_password\0", 16384, 0, NULL, NULL) = 78
sendto(5, "\260\0\0\1\205\246\377\1\0\0\0\1\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dan\0\1\0caching_sha2_password\0s\4_pid\6921668\t_platform\6x86_64\3_os\5Linux\f_client_name\10libmysql\7os_user\3dan\17_client_version\68.0.21\fprogram_name\5mysql", 180, 0, NULL, 0) = 180
recvfrom(5, "\7\0\0\2\0\0\0\2\0\0\0", 16384, 0, NULL, NULL) = 11
Welcome to the MySQL monitor.  Commands end with ; or \g.
sendto(5, "!\0\0\0\3select @@version_comment limit 1", 37, 0, NULL, 0) = 37
recvfrom(5, "\1\0\0\1\1'\0\0\2\3def\0\0\0\21@@version_comment\0\f\377\0p\0\0\0\375\0\0\37\0\0\35\0\0\3\34MySQL Community Server - GPL\7\0\0\4\376\0\0\2\0\0\0", 16384, 0, NULL, NULL) = 92
Your MySQL connection id is 10
Server version: 8.0.21 MySQL Community Server - GPL

Comment by Georg Richter [ 2020-09-25 ]

According to your strace output Connector/C uses the dummy authentication plugin, since the caching_sha2_password plugin could not be found:

from my_auth.c:

  if (!(auth_plugin= (auth_plugin_t*) mysql_client_find_plugin(mysql,
                     auth_plugin_name, MYSQL_CLIENT_AUTHENTICATION_PLUGIN)))
    auth_plugin= &dummy_fallback_client_plugin;

Can you please try to set environment variable MARIADB_PLUGIN_DIR to the path where caching_sha2_password.so and other auth plugins were installed?

Comment by Daniel Black [ 2020-09-25 ]

That works. thanks;

with MARIADB_PLUGIN_DIR

[dan@linux build-mariadb-server-10.2]$ find . -name \*sha2\*.so
./libmariadb/sha256_password.so
./libmariadb/caching_sha2_password.so
[dan@linux build-mariadb-server-10.2]$ MARIADB_PLUGIN_DIR=./libmariadb client/mysql --no-defaults -S /tmp/mysql8.0.sock 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.21 Source distribution
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MySQL [(none)]> select current_user();
+----------------+
| current_user() |
+----------------+
| dan@localhost  |
+----------------+
1 row in set (0.00 sec)

Generated at Thu Feb 08 03:05:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.