Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProcess running out of file descriptors
Forum Updated to NodeBB v4.3 + New Features

QProcess running out of file descriptors

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 4.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DanJChv
    wrote on 11 Feb 2016, 17:45 last edited by
    #1

    When creating a large number of QProcess's, I get messages like these:

    QProcessPrivate::createPipe: Cannot create pipe 0x2af11c285600: Too many open files
    QSocketNotifier: Invalid socket specified

    The problem is I get these error messages, but I haven't found a way via the API to detect that this error has happened. There are apparently no signals and no function calls that I can find that get relevant info. And QProcessPrivate appears not available to the user.

    Ideas?

    K 1 Reply Last reply 11 Feb 2016, 18:09
    0
    • A Offline
      A Offline
      asanka424
      wrote on 11 Feb 2016, 18:00 last edited by
      #2

      Hi,

      I think this should be dealt in OS level. You can increase number of file descriptors in your OS ( I assume you are on Linux. even for windows I think it can)

      Thanks

      1 Reply Last reply
      1
      • D DanJChv
        11 Feb 2016, 17:45

        When creating a large number of QProcess's, I get messages like these:

        QProcessPrivate::createPipe: Cannot create pipe 0x2af11c285600: Too many open files
        QSocketNotifier: Invalid socket specified

        The problem is I get these error messages, but I haven't found a way via the API to detect that this error has happened. There are apparently no signals and no function calls that I can find that get relevant info. And QProcessPrivate appears not available to the user.

        Ideas?

        K Offline
        K Offline
        kshegunov
        Moderators
        wrote on 11 Feb 2016, 18:09 last edited by
        #3

        @DanJChv
        Hello,
        For this to happen you'd need to have an insane amount of open processes, maybe you should consider switching to a different design. However, I'm with @asanka424, this is a system limitation and doesn't have a Qt solution.

        Kind regards.

        Read and abide by the Qt Code of Conduct

        D 1 Reply Last reply 11 Feb 2016, 20:45
        0
        • K kshegunov
          11 Feb 2016, 18:09

          @DanJChv
          Hello,
          For this to happen you'd need to have an insane amount of open processes, maybe you should consider switching to a different design. However, I'm with @asanka424, this is a system limitation and doesn't have a Qt solution.

          Kind regards.

          D Offline
          D Offline
          DanJChv
          wrote on 11 Feb 2016, 20:45 last edited by
          #4

          @kshegunov

          The underlying problem can be fixed on the system level; however, that's not the goal here. The goal is for the program to KNOW there is a problem with the underlying system. If the program runs into this limit, it can request the user contact the system administrators to increase the default limit on number of file descriptors. The most user friendly way is to notify the user only if they are doing something that goes beyond the limit.

          I agree a design that uses fewer QProcesses would be better, but that would be a major revision which I don't have time for. The current problem is occurring with only about 200 QProcesses on a system with a file descriptor limit of 1024.

          K 1 Reply Last reply 11 Feb 2016, 21:14
          0
          • D DanJChv
            11 Feb 2016, 20:45

            @kshegunov

            The underlying problem can be fixed on the system level; however, that's not the goal here. The goal is for the program to KNOW there is a problem with the underlying system. If the program runs into this limit, it can request the user contact the system administrators to increase the default limit on number of file descriptors. The most user friendly way is to notify the user only if they are doing something that goes beyond the limit.

            I agree a design that uses fewer QProcesses would be better, but that would be a major revision which I don't have time for. The current problem is occurring with only about 200 QProcesses on a system with a file descriptor limit of 1024.

            K Offline
            K Offline
            kshegunov
            Moderators
            wrote on 11 Feb 2016, 21:14 last edited by kshegunov 2 Nov 2016, 21:16
            #5

            @DanJChv
            Hello,
            What about QProcess::error or the corresponding signal QProcess::error(QProcess::ProcessError error)? Here the private object sets the error, emits the signal and breaks execution.

            The current problem is occurring with only about 200 QProcesses on a system with a file descriptor limit of 1024.

            You're not the only one requesting a descriptor. What about all the sockets on the system (many if not all daemons use them) and Qt uses some internally as well. So don't be surprised to have run out of them with only with a thousand to start with ... on my system cat /proc/sys/fs/file-max returns 1631401.

            Kind regards.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DanJChv
              wrote on 11 Feb 2016, 23:42 last edited by
              #6

              I have checked the QProcess::error signal, but it isn't called for the case of an invalid file descriptor amazingly.

              K 1 Reply Last reply 12 Feb 2016, 02:27
              0
              • D DanJChv
                11 Feb 2016, 23:42

                I have checked the QProcess::error signal, but it isn't called for the case of an invalid file descriptor amazingly.

                K Offline
                K Offline
                kshegunov
                Moderators
                wrote on 12 Feb 2016, 02:27 last edited by
                #7

                @DanJChv
                Hm, that's strange. The error and status properties could check for these? What version of Qt are you running?

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on 12 Feb 2016, 05:14 last edited by
                  #8

                  Hi everyone. This was discussed in QTBUG-18934 and not considered a bug.

                  K 1 Reply Last reply 12 Feb 2016, 05:44
                  0
                  • ? A Former User
                    12 Feb 2016, 05:14

                    Hi everyone. This was discussed in QTBUG-18934 and not considered a bug.

                    K Offline
                    K Offline
                    kshegunov
                    Moderators
                    wrote on 12 Feb 2016, 05:44 last edited by
                    #9

                    @Wieland
                    Hello,
                    If you take a look at the attached gerrit patch (which seems to have been integrated) I believe the bug's supposed to be fixed. Am I missing something?

                    Kind regards.

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on 12 Feb 2016, 06:47 last edited by
                      #10

                      @kshegunov If I understand the bug report correctly then QProcess crashed the application (SIGSEGV) when running out of file descriptors. With the patch it doesn't crash anymore but enters some bogus state. Thiago said the patch wouldn't make much sense but he'd integrate it anyhow.

                      K 1 Reply Last reply 12 Feb 2016, 06:52
                      0
                      • ? A Former User
                        12 Feb 2016, 06:47

                        @kshegunov If I understand the bug report correctly then QProcess crashed the application (SIGSEGV) when running out of file descriptors. With the patch it doesn't crash anymore but enters some bogus state. Thiago said the patch wouldn't make much sense but he'd integrate it anyhow.

                        K Offline
                        K Offline
                        kshegunov
                        Moderators
                        wrote on 12 Feb 2016, 06:52 last edited by
                        #11

                        @Wieland
                        Maybe I'm in error, I'm by no means an expert. I just follow the code, and it looks like (not necessarily behaves that way though) it should set the error and emit the signal.

                        Read and abide by the Qt Code of Conduct

                        ? 1 Reply Last reply 12 Feb 2016, 06:55
                        0
                        • K kshegunov
                          12 Feb 2016, 06:52

                          @Wieland
                          Maybe I'm in error, I'm by no means an expert. I just follow the code, and it looks like (not necessarily behaves that way though) it should set the error and emit the signal.

                          ? Offline
                          ? Offline
                          A Former User
                          wrote on 12 Feb 2016, 06:55 last edited by
                          #12

                          @kshegunov Ok, might be true. I only read the comments under the bug report.

                          1 Reply Last reply
                          0

                          9/12

                          12 Feb 2016, 05:44

                          • Login

                          • Login or register to search.
                          9 out of 12
                          • First post
                            9/12
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved