Bug #30671 ALTER SERVER causes the Server to crash.
Submitted: 28 Aug 2007 15:37 Modified: 15 Nov 2007 7:21
Reporter: Santo Leto Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Federated storage engine Severity:S2 (Serious)
Version:5.1.20-beta OS:Microsoft Windows (SP2)
Assigned to: Antony Curtis CPU Architecture:Any
Tags: alter server

[28 Aug 2007 15:37] Santo Leto
Description:
ALTER SERVER causes the Server to crash.

How to repeat:
DROP SERVER IF EXISTS `TestBug`;

CREATE SERVER `TestBug` FOREIGN DATA WRAPPER 'mysql' OPTIONS (PORT 3306);

ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE '', USER '', PASSWORD '', SOCKET '', OWNER '', PORT 3306);

ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE 'database1', USER '', PASSWORD '', SOCKET '', OWNER '', PORT 3306);
[28 Aug 2007 16:48] Sveta Smirnova
Thank you for the report.

Verified as described.
[26 Oct 2007 17:43] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36452

ChangeSet@1.2596, 2007-10-26 10:42:21-07:00, antony@pcg5ppc.xiphis.org +2 -0
  Bug#30671
    "ALTER SERVER causes the Server to crash."
    Testcase to prevent regression
[26 Oct 2007 17:43] Antony Curtis
Unable to reproduce crash on multiple platforms. Patch is to guard against regression.
[29 Oct 2007 8:26] Sveta Smirnova
Antony,

I am still able to reproduce bug report on 32-bit Mac and 32-bit Linux.

To repeat:

cat bug30671.test

DROP SERVER IF EXISTS `TestBug`;

CREATE SERVER `TestBug` FOREIGN DATA WRAPPER 'mysql' OPTIONS (PORT 3306);

ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE '', USER '', PASSWORD '', SOCKET '', OWNER '', PORT 3306);

ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE 'database1', USER '', PASSWORD '', SOCKET '', OWNER '', PORT 3306);

(what is exact same queries as in the initial description)

Then use bug30671.test as any other test from our testsuite.

Binaries compiled with script BUILD/compile-pentium-debug-max
[29 Oct 2007 16:06] Antony Curtis
Sveta,
Can you please tell me which version of mysqld you verified with?
Thanks,
[30 Oct 2007 8:46] Santo Leto
Hi,

5.1.21-beta (Win32), 5.1.22-rc (Win32), 6.0.2-alpha (Win32).

Please, note that there are many variants of the initial description which produce the same crash.
Hope this helps.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.21-beta-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> DROP SERVER IF EXISTS `TestBug`;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> CREATE SERVER `TestBug` FOREIGN DATA WRAPPER 'mysql' OPTIONS (PORT
    -> 3306);
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE '', USER '',
    -> PASSWORD '', SOCKET '', OWNER '', PORT 3306);
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE 'database1',
    -> USER '', PASSWORD '', SOCKET '', OWNER '', PORT 3306);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.22-rc-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> DROP SERVER IF EXISTS `TestBug`;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> CREATE SERVER `TestBug` FOREIGN DATA WRAPPER 'mysql' OPTIONS (PORT
    -> 3306);
Query OK, 1 row affected (0.03 sec)

mysql>
mysql> ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE '', USER '',
    -> PASSWORD '', SOCKET '', OWNER '', PORT 3306);
Query OK, 1 row affected (0.03 sec)

mysql>
mysql> ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE 'database1',
    -> USER '', PASSWORD '', SOCKET '', OWNER '', PORT 3306);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 6.0.2-alpha-community-nt-debug-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> DROP SERVER IF EXISTS `TestBug`;
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> CREATE SERVER `TestBug` FOREIGN DATA WRAPPER 'mysql' OPTIONS (PORT
    -> 3306);
Query OK, 1 row affected (0.05 sec)

mysql>
mysql> ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE '', USER '',
    -> PASSWORD '', SOCKET '', OWNER '', PORT 3306);
Query OK, 1 row affected (0.06 sec)

mysql>
mysql> ALTER SERVER `TestBug` OPTIONS (HOST 'localhost', DATABASE 'database1',
    -> USER '', PASSWORD '', SOCKET '', OWNER '', PORT 3306);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[30 Oct 2007 20:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36703

ChangeSet@1.2600, 2007-10-30 13:38:48-07:00, antony@pcg5ppc.xiphis.org +3 -0
  Bug#30671
    "ALTER SERVER causes the server to crash"
    An attempt to pass NULL into strcmp() caused crash.
[1 Nov 2007 19:30] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36918

ChangeSet@1.2601, 2007-11-01 12:30:03-07:00, antony@pcg5ppc.xiphis.org +3 -0
  Bug#30671
    "ALTER SERVER can cause server to crash"
    While retrieving values, it would erronously set the socket value
    to NULL and attempt to use it in strcmp().
    Ensure it is correctly set to "" so that strcmp may not crash.
[7 Nov 2007 22:01] Antony Curtis
queued to 5.1-engines and 6.0-engines repositories
[14 Nov 2007 9:41] Bugs System
Pushed into 6.0.4-alpha
[14 Nov 2007 9:45] Bugs System
Pushed into 5.1.23-rc
[15 Nov 2007 7:21] MC Brown
A note has been added to the 5.1.23 and 6.0.4 changelogs: 

Issuing an ALTER SERVER statement to update the settings for a FEDERATED server would cause the mysqld to crash