Uploaded image for project: 'PBS Pro'
  1. PP-1126

Program started by PBSPro fails to open a network socket

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: 17.1.1
    • Fix Version/s: 18.1.1
    • Component/s: MoM
    • Labels:
      None
    • Sprint:
    • Story Points:
      1

      Description

      Build the following test program:

      #include <Winsock2.h>
      #include <Windows.h>
      #include <stdio.h>
      #include <stdlib.h>
      
      int main(int argc, char **argv) {
        int iResult;
        SOCKET s;
        WSADATA wsaData;
      
        // Initialize Winsock
        iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
        if (iResult != 0) {
            printf("WSAStartup failed: %d\n", iResult);
            return 1;
        }
        s = WSASocket(AF_INET6, SOCK_STREAM, 0, NULL, 0, WSA_FLAG_NO_HANDLE_INHERIT | WSA_FLAG_OVERLAPPED);
        if (s == INVALID_SOCKET)
          fprintf(stderr, "s == INVALID_SOCKET, WSAGetLastError() = %d\n", WSAGetLastError());
        else
          fprintf(stderr, "s == %ld\n", (long)s);
        return ((s == INVALID_SOCKET) ? 1 : 0);
      }
      

      Build with
      cl testsock.c ws2_32.lib

      Prepare the following do_qsub.bat file:

      ::set SystemRoot=C:\WINDOWS
      C:\abspath\to\testsock.exe
      

      replacing C:\abspath\to with the correct path to the testsock.exe binary.

      Now run this command in a shell:
      qsub -S C:\WINDOWS\System32\cmd.exe -o do_qsub.out -e do_qsub.err do_qsub.bat

      type do_qsub.err shows:
      s == INVALID_SOCKET, WSAGetLastError() = 10106

      Uncommenting the
      set SystemRoot=C:\WINDOWS
      line in do_qsub.bat the program runs successfully.
      type do_qsub.err shows:
      s == 312
      Please note that the number above may change.

      The reason of the failure (WSAEPROVIDERFAILEDINIT) is that the environment created by PBSPro is missing the SystemRoot variable.

        Attachments

          Activity

            People

            • Assignee:
              hirenvadalia Hiren Vadalia
              Reporter:
              paolo.tosco.mail Paolo Tosco
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: