Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6388654

hpi::timeout() in 5.0 and subsequent version possibly causes time out problem

XMLWordPrintable

    • b96
    • generic
    • solaris

      hpi::timeout() in 5.0 possibly causes time out problem.

      INVESTIGATION :
       The lines of "ifdef USE_SELECT" block in 1.4.X has been deleted in 5.0.
       There are 2 "ifndef USE_SELECT" blocks in 1.4.2 and those are deleted
       in 5.0 also.
       However, the latter deletion seems to have problem, should not be deleted.
       (Please see the (*) in the extracted source code portion)

      When poll() is called, we think there does not happen timeout.
      However, in 5.0 program logic, if an interruption occurs for poll() system call,
      timeout seems to occur.


      JDK1.4.2_10:
      ----- hpi::timeout() in hotspot/src/os/solaris/vm/hpi_solaris.hpp-----
      ....
        for(;;) {
      #ifdef USE_SELECT
          t.tv_sec = timeout / 1000;
          t.tv_usec = (timeout % 1000) * 1000;


          INTERRUPTIBLE_NORESTART(::select(fd + 1, &tbl, 0, 0, &t), res, os::Solaris::clear_interrupted);
      #else

          INTERRUPTIBLE_NORESTART(::poll(&pfd, 1, timeout), res, os::Solaris::clear_interrupted);
      #endif
          if(res == OS_ERR && errno == EINTR) {

      #ifndef USE_SELECT <=====(*), deleted in 5.0
            if(timeout != -1) {
      #endif
              gettimeofday(&t, &aNull);
              newtime = t.tv_sec * 1000 + t.tv_usec /1000;
              timeout -= newtime - prevtime;
              if(timeout <= 0)
                return OS_OK;
              prevtime = newtime;
      #ifndef USE_SELECT
            }
      #endif
          } else
      ....
      -------------------------------------------------------------------------

            blacklion Lev Serebryakov (Inactive)
            tbaba Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: