Bug #82759 --dba enableXProtocol should do more error checking
Submitted: 28 Aug 2016 12:37 Modified: 5 Oct 2021 13:27
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Document Store: MySQL Shell Severity:S3 (Non-critical)
Version:1.0.4 OS:Any
Assigned to: CPU Architecture:Any

[28 Aug 2016 12:37] Daniël van Eeden
Description:
When using mysqlshell with '--dba enableXProtocol' it might look like X Protocol was successfully enabled when it was not.

How to repeat:
====================================================================
$ mysqlsh --user=msandbox --password=msandbox --port=5714 --socket=/tmp/mysql_sandbox5714.sock --dba enableXProtocol --classic
mysqlx: [Warning] Using a password on the command line interface can be insecure.
Creating a Classic Session to msandbox@localhost:5714
No default schema selected.

enableXProtocol: Installing plugin mysqlx...
enableXProtocol: done
====================================================================

From error log:
====================================================================
2016-08-28T12:15:18.608425Z 4 [Note] Plugin mysqlx reported: 'X plugin tcp connection enable at port 33060.'
2016-08-28T12:15:18.608487Z 4 [ERROR] Plugin mysqlx reported: 'Could not bind to port 33060: Address already in use (98)'
2016-08-28T12:15:18.608585Z 4 [Note] Plugin mysqlx reported: 'Scheduler "work" started.'
2016-08-28T12:15:18.608624Z 4 [Note] Plugin mysqlx reported: 'X plugin initialization successes'
2016-08-28T12:15:18.610336Z 0 [Warning] Plugin mysqlx reported: 'Failed at SSL configuration: "SSL context is not usable without certificate and private key"'
2016-08-28T12:15:18.610347Z 0 [Note] Plugin mysqlx reported: 'Using YaSSL for TCP connections'
2016-08-28T12:15:18.610350Z 0 [ERROR] Plugin mysqlx reported: 'Tcp socket creation or bind failed'
2016-08-28T12:15:18.610383Z 0 [ERROR] Plugin mysqlx reported: 'Error preparing to accept connections'
2016-08-28T12:15:18.610388Z 0 [ERROR] Plugin mysqlx reported: 'Delayed startup failed. Plugin is unable to accept connections.'
====================================================================

Suggested fix:
1. After enabling, check if the plugin is loaded, active and has no init errors.

SELECT COUNT(*) FROM information_schema.plugins WHERE plugin_name='mysqlx' AND plugin_status='ACTIVE';

SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE variable_name='Mysqlx_init_error';

In my case init_error was 0... I'll file another error for that. This bug is about the client, not the server.

2. Actually make a mysqlx connection (maybe add a --skip-connection-test option).

Connect to @@global.mysqlx_port, which might not be 33060

This could verify if a connection could be made.
Check @@global.server_uuid on both connections to ensure it is the same instance.
[28 Aug 2016 12:46] Daniël van Eeden
Related
Bug #82761 	If binding to mysqlx port fails this is not visible from status vars
[28 Aug 2016 18:46] MySQL Verification Team
Hello Daniël,

Thank you for the report.
Imho, this is duplicate of Bug #81826, please see Bug #81826

Thanks,
Umesh
[28 Aug 2016 19:09] Daniël van Eeden
I don't think this is a duplicate of #81826
That bug is related, but is about the server side mysqlx pulugin.
This bug is about the client (mysql shell) which should do more verification after the enableXProtocol plugin. This can be done without server side modifications (e.g. just try to setup an X Protocol session)
[29 Aug 2016 5:06] MySQL Verification Team
Thank you for the feedback!
[5 Oct 2021 13:27] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL Shell 8.0.27:

When MySQL Shell’s command-line option --dba=enableXProtocol was used to install and enable X Plugin on connection with a MySQL 5.7 server, the process verified that the install command did not return any errors, but did not verify that the plugin had installed correctly and accepted the appropriate connection type. MySQL Shell now verifies the plugin state before returning a response to the user so they can see whether the plugin is now usable.