Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/31#discussion_r35012380
  
    --- Diff: core/sql/executor/JavaObjectInterface.cpp ---
    @@ -147,19 +147,29 @@ int JavaObjectInterface::createJVM()
         }
       }
     
    -#ifdef _DEBUG
       int debugPort = 0;
       const char *debugPortStr = getenv("JVM_DEBUG_PORT");
       if (debugPortStr != NULL)
          debugPort = atoi(debugPortStr);
    -  const char *debugTimeoutStr = getenv("JVM_DEBUG_TIMEOUT");
    -  if (debugTimeoutStr != NULL)
    -     debugTimeout_ = atoi(debugTimeoutStr);
    -  const char *suspendOnDebug = getenv("JVM_SUSPEND_ON_DEBUG");
    -  char debugOptions[300];
    -  if (debugPort > 0)
    +  if (debugPort > 0
    +#ifdef NDEBUG
    +      // in a release build, only DB__ROOT can debug a process
    +      && ComUser::isRootUserID()
    +#endif
    +     )
       {
    -     debugPort_ = debugPort + (GetCliGlobals()->myPin() % 1000);
    +     const char *debugTimeoutStr = getenv("JVM_DEBUG_TIMEOUT");
    +     if (debugTimeoutStr != NULL)
    +       debugTimeout_ = atoi(debugTimeoutStr);
    +     const char *suspendOnDebug = getenv("JVM_SUSPEND_ON_DEBUG");
    +     char debugOptions[300];
    +
    +     debugPort_ = debugPort;
    +     // to allow debugging multiple processes at the same time,
    +     // specify a port that is a multiple of 1000 and the code will
    +     // add pid mod 1000 to the port number to use
    +     if (debugPort_ % 1000 == 0)
    +       debugPort_ += (GetCliGlobals()->myPin() % 1000);
    --- End diff --
    
    What's the probability of port collisions? How does one identify them? I 
suppose a way to work around port collisions is to stop and restart the 
affected processes?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to