Bug #16807 $SLAVE_MYPORT can't be substituted in mysqltest with nondefault ports
Submitted: 26 Jan 2006 14:53 Modified: 31 Mar 2006 11:45
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:
Assigned to: Kent Boortz CPU Architecture:Any

[26 Jan 2006 14:53] Oleksandr Byelkin
Description:
I got test fail like this:
-------------------------------------------------------
*** r/rpl000002.result  Thu Jan 26 13:46:51 2006
--- r/rpl000002.reject  Thu Jan 26 15:50:02 2006
***************
*** 14,20 ****
  2002
  show slave hosts;
  Server_id     Host    Port    Rpl_recovery_rank       Master_id
! 2     127.0.0.1       9999    2       1
  drop table t1;
  stop slave;
  create table t2(id int auto_increment primary key, created datetime);
--- 14,20 ----
  2002
  show slave hosts;
  Server_id     Host    Port    Rpl_recovery_rank       Master_id
! 2     127.0.0.1       6192    2       1
  drop table t1;
  stop slave;
  create table t2(id int auto_increment primary key, created datetime);
-------------------------------------------------------

How to repeat:
run autopush with --mtr_build_thread=12345
[3 Feb 2006 9:35] Kristian Nielsen
The problem is that the port numbers are calculated something like 8200 + MTR_BUILD_THREAD * 40.

But there is no check for overflow, TCP ports cannot be >65535. Also ports above some limit (can't remember offhand) are chosen automatically by the OS for outgoing connections, so could conflict at random.

mysql-test-run.pl and mysql-test-run.sh need an error check to fail if MTR_BUILD_THREAD is specified too large (or negative, or floating-point, or ...).
[29 Mar 2006 22:49] 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/4298
[31 Mar 2006 11:45] Kent Boortz
After caclulating the port range from the MTR_BUILD_THREAD
environment variable, the range is checked to make sure it
is in the "safe range" for most operating systems. The safe
range is outside the reserved and "ephemeral" ranges,
http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html