Important: Please read the Qt Code of Conduct -

Qt "Session management error" on start up

  • Qt 5.7, Linux. I have an intermittent (fairly infrequent) error as the very thing which happens on starting to run my Qt application. (The fact that I use PyQt/Python should not be relevant, I understand that I'm more or less on my own in that respect.) The very first thing I see output is:

    Qt: Session management error: Could not open network socket

    This message happens intermittently, some days yes, some days no, there is no pattern, and has no relationship to any changes I might make in my code or not. The application actually continues to run fine. I have to restart the Linux machine for it to disappear, which is a bit pants.

    Where does that Qt "Session management error" come from, why is trying to open a network socket, and what does it signify?

  • Lifetime Qt Champion

  • @jsulm
    Yeah, I could have Googled, I spend all my time Googling others' question, I got lazy and fancied a chat about this :)

    Your link takes me to I don't have a hostname issue, I don't use any KDE stuff, I do use GNOME, but the find reveals no *session* files recently modified that are of any relevance. Ho-hum.

    I'll just try logging off & logging on again, instead of rebooting, to see if that fixes, and report back....

  • Lifetime Qt Champion

    @JonB OK, other possibility would be to search for this string in Qt sources to see what the condition for printing this is.

  • @jsulm

    1. Logging off did not clear. Rebooting did. I won't die in a ditch over this one, but I am interested as to what it is.

    2. Lots of Google hits for others hitting this, no solutions/explanations (at least as applies to me).

    3. I have to search online sources for Qt (I'm not C++). I believe the error comes at .

    That would make it in QXcbSessionManager. What's one of those all about, OOI, please?

    That function starts with:

        // avoid showing a warning message below
        if (!qEnvironmentVariableIsSet("SESSION_MANAGER"))

    I don't know whether that variable is supposed to be set/clear under some circumstances so that the code error is not hit, or whether the code call is supposed to be made but should not error?

  • Lifetime Qt Champion


    You can find more information about that variable here.

    The QXXXSessionManager classes are used by application that wants to save/restore stuff on "session stop/restart". A session being started when you login to your desktop environment and stops when you logout.

Log in to reply