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. MacOS: Qt 5.7.0 constantly reading SystemConfiguration

MacOS: Qt 5.7.0 constantly reading SystemConfiguration

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 2.8k 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.
  • S Offline
    S Offline
    smitmartijn
    wrote on last edited by
    #1

    Hi,

    Here's an interesting one: I've got a substantial amount of code in this program, so I won't bother posting code yet. It uses a few network/system configuration functions to get the system configuration, has a tiny webserver inside and also does http requests.

    I recently upgraded from Qt 5.3 to 5.7 and found something weird. The app is polling the SystemConfiguration every 10 seconds.

    2017 Mar 4 22:34:16 501 10912 TestApp     32 0 /Library/Preferences/SystemConfiguration/preferences.plist
    2017 Mar 4 22:34:16 501 10912 TestApp 32 0 /System/Library/Frameworks/SystemConfiguration.framework/Resources/English.lproj/NetworkInterface.strings
    2017 Mar 4 22:34:16 501 10912 TestApp 32 0 /System/Library/Frameworks/SystemConfiguration.framework/Resources/English.lproj/NetworkInterface.strings
    2017 Mar 4 22:34:16 501 10912 TestApp 32 0 /System/Library/Frameworks/SystemConfiguration.framework/Resources/English.lproj/NetworkInterface.strings
    2017 Mar 4 22:34:16 501 10912 TestApp 32 0 /System/Library/Frameworks/SystemConfiguration.framework/Resources/English.lproj/NetworkInterface.strings
    2017 Mar 4 22:34:16 501 10912 TestApp 32 0 /System/Library/Frameworks/SystemConfiguration.framework/Resources/English.lproj/NetworkInterface.strings
    

    And on and on. I've profiled all the functions inside the app (logging when something is called) and got nothing that was on the same timing as these requests. There's no 10 second timer at all.

    Has anyone come across this behaviour and how can I stop this?

    Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      smitmartijn
      wrote on last edited by
      #5

      For those interested, this turned out to be an issue with QNetworkAccessManager in Qt 5.3.1 and above (still not fixed!) where the network interfaces are rescanned every 10 seconds when you're on a wireless connection.

      More information:

      https://bugreports.qt.io/browse/QTBUG-46015
      https://bugreports.qt.io/browse/QTBUG-40332

      It's pretty unbelievable that this hasn't been fixed yet, considering it's pretty disruptive. To implement a workaround, add an environment variable:

      qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));

      A 1 Reply Last reply
      2
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi and welcome to devnet,

        Can you double check with a more recent version of Qt ? The current is 5.8.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • S Offline
          S Offline
          smitmartijn
          wrote on last edited by
          #3

          Hi,

          Luckily I had a test VM where Qt 5.8.0 was on. I copiled the app on there and looked at the open files, same thing.

          A 1 Reply Last reply
          0
          • S smitmartijn

            Hi,

            Luckily I had a test VM where Qt 5.8.0 was on. I copiled the app on there and looked at the open files, same thing.

            A Offline
            A Offline
            ambershark
            wrote on last edited by
            #4

            @smitmartijn I don't know if you can use something like strace on osx I haven't tried it, but if you can run it to see what your app is doing when it is using SystemConfiguration.

            That is definitely weird unless maybe you are having some network connection attempt from your app or something that is using SystemConfiguration for the network properties.

            If you could try to make a simple test app that duplicates this behavior for us to see the code/test with it would be easier to help diagnose.

            I've done a lot of OSX coding and haven't seen that with Qt, however, I haven't done much since Qt 5.5 or so on osx. So it could be a bug, but more than likely it's something your app is doing. Especially check any place that access a network resource for a potential issue.

            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

            1 Reply Last reply
            0
            • S Offline
              S Offline
              smitmartijn
              wrote on last edited by
              #5

              For those interested, this turned out to be an issue with QNetworkAccessManager in Qt 5.3.1 and above (still not fixed!) where the network interfaces are rescanned every 10 seconds when you're on a wireless connection.

              More information:

              https://bugreports.qt.io/browse/QTBUG-46015
              https://bugreports.qt.io/browse/QTBUG-40332

              It's pretty unbelievable that this hasn't been fixed yet, considering it's pretty disruptive. To implement a workaround, add an environment variable:

              qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));

              A 1 Reply Last reply
              2
              • S smitmartijn

                For those interested, this turned out to be an issue with QNetworkAccessManager in Qt 5.3.1 and above (still not fixed!) where the network interfaces are rescanned every 10 seconds when you're on a wireless connection.

                More information:

                https://bugreports.qt.io/browse/QTBUG-46015
                https://bugreports.qt.io/browse/QTBUG-40332

                It's pretty unbelievable that this hasn't been fixed yet, considering it's pretty disruptive. To implement a workaround, add an environment variable:

                qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));

                A Offline
                A Offline
                ambershark
                wrote on last edited by
                #6

                @smitmartijn Wow, thanks for following up. That is crazy that hasn't been fixed yet. A 10 second polling seems like just plain bad design. Especially if it's causing logging every time.

                The beauty of Qt is you can always fix it yourself. :) I've done that a few times. They will probably even take a patch from you to fix it if it doesn't cause other issues or is against their coding standards, etc.

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                S 1 Reply Last reply
                0
                • A ambershark

                  @smitmartijn Wow, thanks for following up. That is crazy that hasn't been fixed yet. A 10 second polling seems like just plain bad design. Especially if it's causing logging every time.

                  The beauty of Qt is you can always fix it yourself. :) I've done that a few times. They will probably even take a patch from you to fix it if it doesn't cause other issues or is against their coding standards, etc.

                  S Offline
                  S Offline
                  smitmartijn
                  wrote on last edited by
                  #7

                  @ambershark No problem. I'm not going to pretend I have the skills to fix it in the Qt source though. ;-)

                  1 Reply Last reply
                  1

                  • Login

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