Uploaded image for project: 'Sqoop (Retired)'
  1. Sqoop (Retired)
  2. SQOOP-3283

MySQL thirdparty tests hang if there's no USER environment variable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.4.7
    • 1.5.0
    • connectors/mysql, test
    • None

    Description

      org.apache.sqoop.manager.mysql.MySQLTestUtils#getCurrentUser() executes whoami in a subprocess if there's no USER environment variable (happened to me while running tests from Docker). However, it waits for the Process variable to become null, that never happens:

      // wait for whoami to exit.
      while (p != null) {
        try {
          int ret = p.waitFor();
          if (0 != ret) {
            LOG.error("whoami exited with error status " + ret);
            // suppress original return value from this method.
            return null;
          }
        } catch (InterruptedException ie) {
          continue; // loop around.
        }
      }
      

      We could get rid of the while loop since Process#waitFor() blocks while it completes.

      Note, that it's easy to workaround the issue by setting the USER environment variable when running the tests.

      Attachments

        1. SQOOP-3283.1.patch
          2 kB
          Daniel Voros
        2. SQOOP-3283.2.patch
          3 kB
          Daniel Voros

        Issue Links

          Activity

            People

              dvoros Daniel Voros
              dvoros Daniel Voros
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: