Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails
Submitted: 26 Jun 2009 0:17 Modified: 19 Dec 2009 0:12
Reporter: Timothy Smith Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S7 (Test Cases)
Version:any new MTR OS:IBM AIX (AIX and i5/OS)
Assigned to: Bjørn Munch CPU Architecture:Any

[26 Jun 2009 0:17] Timothy Smith
Description:
The i5/OS mtr runs are failing with this symptom:

...
vardir: /home/mysqldev/tmp-200905141024-5.1.35-11475/i5os-power-32bit/test/mysql-test/var
Removing old var directory...
Creating var directory '/home/mysqldev/tmp-200905141024-5.1.35-11475/i5os-power-32bit/test/mysql-test/var'...
mysql-test-run: *** ERROR: Socket path '/tmp/ho5MPUy6Y9' too long, it would be  truncated and thus not possible to use for connection to  MySQL Server. Set a shorter with --tmpdir=<path> option

The root cause of this can be reproduced with the following simple test case:

sock=/tmp/test-sock.$$
perl -MIO::Socket::UNIX -e "warn IO::Socket::UNIX->new(Local => '$sock',
Listen => 1)->hostpath();"
rm -f $sock

The perl command will result in:

Bad arg length for Socket::unpack_sockaddr_un, length is 25, should be 106
at /QOpenSys/perl/lib/5.8.0/aix/Socket.pm line 380.

It should print out:

/tmp/test-sock.3576 at -e line 1.

So, this is a bug in the default Perl on AIX and i5/OS.  Upgrading Perl didn't seem to help either, although there is some Perl version which doesn't exhibit this problem (see /usr/local/perl/bin/perl on aix.mysql.com, and the aix53 release build test runs for, e.g., 5.1.36).

How to repeat:
Try to run a current MTR (e.g., from mysql-5.1) on an AIX or i5/OS host.

Or, see small perl snippet above which shows the base problem (in Perl's IO::Socket::Unix module).

Also, notice the failures on i5os at

http://clustra.norway.sun.com/~bteam/status/mysql-5.1.36/builds.html

Suggested fix:
Since fixing this appears to require a custom Perl build, I think it would be best to add a workaround for this in mysql-test/lib/My/Platform.pm.  Something like this (untested) patch should be good:

=== modified file 'mysql-test/lib/My/Platform.pm'
--- mysql-test/lib/My/Platform.pm       2009-02-25 09:32:13 +0000
+++ mysql-test/lib/My/Platform.pm       2009-06-26 00:10:46 +0000
@@ -126,8 +126,21 @@ sub check_socket_path_length {
     die "Could not create UNIX domain socket: $!"
       unless defined $sock;
 
+    my $hostpath = eval {$sock->hostpath()};
+    if ($@) {
+      die unless $@ =~ /^Bad arg length for Socket::unpack_sockaddr_un/;
+
+      # Bug on AIX and i5/OS Perl IO::Socket::UNIX which dies with something
+      # like:
+      #   Bad arg length for Socket::unpack_sockaddr_un, length is 25,
+      #   should be 106 at /path/to/perl/lib/5.8.0/aix/Socket.pm line 380.
+      #
+      # Just fake it that everything is fine
+      $hostpath = $testfile;
+    }
+
     die "UNIX domain socket path was truncated"
-      unless ($testfile eq $sock->hostpath());
+      unless ($testfile eq $hostpath);
 
     $truncated= 0; # Yes, it worked!

Also, it would be really nice if unexpected errors didn't get swallowed up here.  Something like this would work for that:

=== modified file 'mysql-test/lib/My/Platform.pm'
--- mysql-test/lib/My/Platform.pm       2009-02-25 09:32:13 +0000
+++ mysql-test/lib/My/Platform.pm       2009-06-26 00:14:27 +0000
@@ -126,13 +126,16 @@ sub check_socket_path_length {
     die "Could not create UNIX domain socket: $!"
       unless defined $sock;
 
-    die "UNIX domain socket path was truncated"
+    die "TRUNCATED"
       unless ($testfile eq $sock->hostpath());
 
     $truncated= 0; # Yes, it worked!
 
   };
 
+  die "Unexpected failure when checking socket path lenght: $@"
+    if $@ and $@ !~ /^TRUNCATED/;
+
   $sock= undef;  # Close socket
   rmtree($tmpdir); # Remove the tempdir and any socket file created
   return $truncated;
[4 Aug 2009 9:01] 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/79976

2811 Bjorn Munch	2009-08-04
      Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails
      Bug is actually in Perl
      Fixed by trapping and ignoring error from IO::Socket::UNIX
[5 Aug 2009 7:42] 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/80121

2811 Bjorn Munch	2009-08-05
      Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails
      Bug is actually in Perl
      Fixed by trapping and ignoring error from IO::Socket::UNIX
[5 Aug 2009 8:02] Bjørn Munch
Pushed to azalea-mtr and 5.1-mtr
[5 Aug 2009 12:07] 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/80144

2812 Bjorn Munch	2009-08-05
      Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails
      Bug in Perl
      Scrap attempt to do this smartly on AIX, just drop the test and assume it's OK
      This commit undoes the previous push and adds a line to ignore on AIX
[5 Aug 2009 17:58] 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/80206

2812 Bjorn Munch	2009-08-05
      Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails
      Bug in Perl
      Scrap attempt to do this smartly on AIX, just drop the test and assume it's OK
      This commit undoes the previous push and adds a line to ignore on AIX
[6 Aug 2009 7:31] 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/80242

2812 Bjorn Munch	2009-08-06
      Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails
      Bug in Perl
      Scrap attempt to do this smartly on AIX, just drop the test and assume it's OK
      This commit undoes the previous push and adds a line to ignore on AIX
[6 Aug 2009 7:39] Bjørn Munch
Re-pushed to azalea-mtr and 5.1-mtr
[3 Sep 2009 17:12] Bugs System
Pushed into 5.1.40 (revid:bjorn.munch@sun.com-20090903170735-679d64zp580wl39j) (version source revid:bjorn.munch@sun.com-20090903170735-679d64zp580wl39j) (merge vers: 5.1.40) (pib:11)
[4 Sep 2009 0:51] Paul DuBois
Test suite change. No changelog entry needed.

Setting report to NDI pending push into 5.4.x.
[30 Sep 2009 8:18] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20090929093622-1mooerbh12e97zux) (version source revid:alik@sun.com-20090922182109-vs5ign07cwht12z6) (merge vers: 6.0.14-alpha) (pib:11)
[30 Sep 2009 8:20] Bugs System
Pushed into 5.4.5-beta (revid:alik@sun.com-20090925094254-tjl9eajkzwzgthoe) (version source revid:alik@sun.com-20090922142453-x275o41whpyezh4q) (merge vers: 5.4.4-beta) (pib:11)
[30 Sep 2009 19:36] Paul DuBois
Test suite change. No changelog entry needed.
[18 Dec 2009 10:32] Bugs System
Pushed into 5.1.41-ndb-7.1.0 (revid:jonas@mysql.com-20091218102229-64tk47xonu3dv6r6) (version source revid:jonas@mysql.com-20091218095730-26gwjidfsdw45dto) (merge vers: 5.1.41-ndb-7.1.0) (pib:15)
[18 Dec 2009 10:47] Bugs System
Pushed into 5.1.41-ndb-6.2.19 (revid:jonas@mysql.com-20091218100224-vtzr0fahhsuhjsmt) (version source revid:jonas@mysql.com-20091217101452-qwzyaig50w74xmye) (merge vers: 5.1.41-ndb-6.2.19) (pib:15)
[18 Dec 2009 11:03] Bugs System
Pushed into 5.1.41-ndb-6.3.31 (revid:jonas@mysql.com-20091218100616-75d9tek96o6ob6k0) (version source revid:jonas@mysql.com-20091217154335-290no45qdins5bwo) (merge vers: 5.1.41-ndb-6.3.31) (pib:15)
[18 Dec 2009 11:17] Bugs System
Pushed into 5.1.41-ndb-7.0.11 (revid:jonas@mysql.com-20091218101303-ga32mrnr15jsa606) (version source revid:jonas@mysql.com-20091218064304-ezreonykd9f4kelk) (merge vers: 5.1.41-ndb-7.0.11) (pib:15)