Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-17331

QProcess::execute uses fork() which may fail on Linux system with overcommit_memory=0 and no swap

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.15.0 Beta3
    • 4.7.1
    • Core: I/O
    • None
    • Embedde Linux, and maybe also Desktop Linux or any other Unix.
      I've experianced it on Embedded ARM based Linux with no swap space and overcommit_memory=0 (the default)
    • 028ddf3633f394c930ddb82551ef2d1fa9b1a04a (qt/qtbase/5.15)

      Imagine an embedded Linux system with 64mb of RAM, and Qt program that consumes 40mb.
      This process will fail executing even a tiny program (e.g. "ls -l"), since the fork will first try to duplicate the creating process that that would mean the kernel committing to 80mb of RAM, even though it uses CopyOnWrite, the kernel's overcommit policy will not allow it.

      instead of fork you should either use vfork or posix_spawn.

      you can find some more info in:
      http://developers.sun.com/solaris/articles/subprocess/subprocess.html
      http://www.mail-archive.com/redhat-list@redhat.com/msg129118.html
      http://www.kernel.org/doc/Documentation/sysctl/vm.txt

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            oranagra Oran Agra
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes