Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-729

packages/commands promise cannot install MySQL packages from mysql.com / SIGPIPE handling

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.0
    • Component/s: None
    • Labels:
      None

      Description

      During installation of MySQL-server package (5.6.12) from http://dev.mysql.com/downloads/mysql/ cfagent hangs with following ps output:

      <pre>
      (1) root 12475 12318 0 14:12 pts/0 00:00:01 /usr/bin/zypper --non-interactive install --from sles11-repo-sp2 MySQL-server
      (2) root 12480 12475 3 14:12 pts/0 00:00:06 rpm --root / --dbpath /var/lib/rpm -U --percent --force --nodeps – /var/cache/zypp/packages/sles11-repo-sp2/rpm/MySQL-server-5.6.12-1.sles11.x86_64.rpm
      (3) root 12496 12480 0 14:12 pts/0 00:00:00 /bin/sh /var/tmp/rpm-tmp.81086 1
      (4) root 12512 12496 0 14:12 pts/0 00:00:00 /usr/bin/perl /usr/bin/mysql_install_db --rpm --user=mysql --random-passwords
      (5) root 12515 12512 0 14:12 pts/0 00:00:00 sh -c cat /dev/urandom | LC_ALL=C tr -dc "[:alnum:]" | fold -w 8 | head -1
      (6) root 12516 12515 95 14:12 pts/0 00:02:34 cat /dev/urandom
      (7) root 12517 12515 3 14:12 pts/0 00:00:04 tr -dc [:alnum:]
      (8) root 12518 12515 1 14:12 pts/0 00:00:01 fold -w 8
      </pre>

      Reason for hanging is the 'mysql_install_db' (4) command that executes a shell to generate a random 8 character password using in (5). You can see that "head -1" already finished (after the first 8 bytes) here. "cat /dev/urandom" with 95% cpu is still copying bytes from /dev/urandom to STDOUT, through "tr" into the "fold" command.

      From strace you can see that the fold command received numerous SIGPIPEs that seem to get ignored (-> the process does not die).

      Same can be seen when invoking "mysql_install_db" from commands promise.

      bug.cf:

      <pre>
      body common control { bundlesequence =>

      { "main" }

      ; }
      bundle agent main {
      commands:
      "/tmp/t.pl";
      }
      </pre>

      t.pl (stripped down version of "mysql_install_db"):

      <pre>
      #!/usr/bin/perl
      my $password = `cat /dev/urandom | LC_ALL=C tr -dc "[:alnum:]" | fold -w 8 | head -1`;
      print "P: $password";
      </pre>

        Attachments

          Activity

            People

            • Assignee:
              a10040 Kristian Amlie
              Reporter:
              jkrabbe J. Krabbe
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel