mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
07.03.2008 2792f4abcafa1c2a31caeaf018ea58611c6e8a64
Fix for issue 3566 (Increase the timeout of the windows service and consider making it configurable).

The fix increases the number of tries used to figure out if the server is started or not. This is required in particular after reboot since the system can be really loaded.

The user can modify the default tries value (100 tries with an interval of 5 seconds between tries) by setting the value of the OPENDS_WINDOWS_SERVICE_START_NTRIES environment variable (it must be a SYSTEM environment variable in order to be taken into account).
4 files modified
27 ■■■■ changed files
opends/lib/launcher_administrator.exe patch | view | raw | blame | history
opends/lib/opends_service.exe patch | view | raw | blame | history
opends/lib/winlauncher.exe patch | view | raw | blame | history
opends/src/build-tools/windows/service.c 27 ●●●● patch | view | raw | blame | history
opends/lib/launcher_administrator.exe
Binary files differ
opends/lib/opends_service.exe
Binary files differ
opends/lib/winlauncher.exe
Binary files differ
opends/src/build-tools/windows/service.c
@@ -515,16 +515,29 @@
    if (spawn(command, FALSE) != -1)
    {
      // Try to see if server is really running
      int nTries = 10;
      int nTries = 100;
      char * nTriesEnv = getenv("OPENDS_WINDOWS_SERVICE_START_NTRIES");
      BOOL running = FALSE;
      if (nTriesEnv != NULL)
      {
        nTries = (int)strtol(nTriesEnv, (char **)NULL, 10);
        if (nTries <= 0)
        {
          nTries = 100;
        }
      }
      else
      {
        debug("OPENDS_WINDOWS_SERVICE_START_NTRIES is not set.  Using default 50 tries.");
      }
      debug(
          "doStartApplication: the spawn of the process worked.  Command: '%s'",
          command);
      // Wait to be able to launch the java process in order it to free the lock
      // Wait to be able to launch the java process in order it to get the lock
      // on the file.
      debug("Sleeping for 3 seconds to allow the process to free the lock.");
      Sleep(3000);
      debug("Sleeping for 5 seconds to allow the process to get the lock.");
      Sleep(5000);
      while ((nTries > 0) && !running)
      {
        nTries--;
@@ -534,9 +547,9 @@
        }
        if (!running)
        {
          debug("Sleeping for 2 seconds to allow the process to free the lock.  %d tries remaining.",
          debug("Sleeping for 5 seconds to allow the process to get the lock.  %d tries remaining.",
              nTries);
          Sleep(2000);
          Sleep(5000);
        }
      }
      if (running)
@@ -1278,7 +1291,7 @@
} // getBinaryPathName
// ---------------------------------------------------------------
// Returns the list of NT services being created on the current host.
// Returns the list of Windows services being created on the current host.
// The function allocates the memory for the returned buffer.
// serviceList contains the list of services.
// nbServices the number of services returned in the list.