Very strange problem (possible bug in XOrg).

Krivenok Dmitry _asr_ at inbox.ru
Thu Oct 12 15:43:40 PDT 2006


Hello All!

I'm having trouble with my Xorg.
I've reviewed XOrg's source code and located the problem.
So, the problem consist in ReadRequestFromClient function, which returns -1.
Implementation of this function is located in xc/programs/Xserver/dix/dispatch.c file.
Hence, Despatch() terminates immediately and we have the following behaviour:

/* *** xc/programs/Xserver/dix/main.c *** */
....
....
//Main endless loop
while(1)
  {
    Initialization (including ScreenInit-callback call)
    Dispatch (which terminates immediately)
    Cleaning (including CloseScreen-callback call)
  }
....
....

>From user's point of view the problem consist in strange screen flicker 
(black screen, gray screen, black screen, gray screen, etc...).
Gray screen (with cursor) corresponds to Initialization phase and black screen
corresponds to Cleaning phase.

I've once-overed ReadRequestFromClient's source code and found that "result" in the following code

//////////////////////////////////////////////////////////////////////////////

/* *** xc/programs/Xserver/os/io.c *** */

#ifdef LBX
        if (oc->proxy && oc->proxy->compHandle)
            result = (*oc->proxy->streamOpts.streamCompRead)(fd,
                             (unsigned char *)oci->buffer + oci->bufcnt,
                             oci->size - oci->bufcnt);
        else
#endif
            result = _XSERVTransRead(oc->trans_conn, oci->buffer + oci->bufcnt,
                                     oci->size - oci->bufcnt);
//////////////////////////////////////////////////////////////////////////////

is equal to 0 (or sometimes -1) in my case.

And then -1 is returned here:
//////////////////////////////////////////////////////////////////////////////
if (result <= 0)
        {
            if ((result < 0) && ETEST(errno))
            {
#if defined(SVR4) && defined(i386) && !defined(sun)
#if defined(LBX) && 0
                /*
                 * For LBX connections, we can get a valid EWOULDBLOCK
                 * There is probably a better way of distinguishing LBX
                 * connections, but this works. (DHD)
                 */
                extern int LbxRead();
                if (oc->Read == LbxRead)
#else
                if (0)
#endif
#endif
                {
                    YieldControlNoInput();
                    return 0;
                }
            }
            return -1;
        }
//////////////////////////////////////////////////////////////////////////////

IMPORTANT NOTES:
1) Described problem occurs ONLY after closing KDE session.
It never appears directly after "startx" command (i.e. first session works fine).

2) I've tested it on EBOX-III (disk-less thin-client).
It uses remote terminal server with x-clients and KDM (KDE Display Manager).
Local X-Server is runned as fallows:
Xorg -query <terminal_server_IP>

QUESTIONS:
1) Why "result" in code above has invalid value (0 or -1)?
2) Is there a rationale of my problem (maybe config options or environment vars are missing or wrong)?
3) Is it a bug?

Thank you beforehand!




More information about the xorg mailing list