Captured by X - Xwindows

This is a discussion on Captured by X - Xwindows ; Hello all, I have a program, which is connected to several X-Terminals. If I disconnect one of these X-Terminals, my program gets stuck in an X- call and I see the following stack in the debugger: (gdb) bt #0 0x4030d9f8 ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Captured by X

  1. Captured by X

    Hello all,

    I have a program, which is connected to several X-Terminals. If I
    disconnect one of these X-Terminals, my program gets stuck in an X-
    call and I see the following stack in the debugger:

    (gdb) bt
    #0 0x4030d9f8 in select () from /lib/tls/libc.so.6
    #1 0x4018a980 in _XGetAsyncData () from /usr/X11R6/lib/libX11.so.6
    #2 0x4018b148 in _XFlush () from /usr/X11R6/lib/libX11.so.6
    #3 0x4018af77 in _XFlush () from /usr/X11R6/lib/libX11.so.6
    #4 0x40170f9c in XFlush () from /usr/X11R6/lib/libX11.so.6
    #5 0x080600f7 in my-function
    ..
    ..

    Normally I would have expected to run into an XIO-Error, which I could
    handle. But it looks, as if my program stucks in the select call,
    until I reconnect the X-Terminal or until I restart the my program.

    Has anybody an idea that might help?

    Thank you in advance

    Dieter

  2. Re: Captured by X

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Dieter Müller wrote:

    > Hello all,
    >
    > I have a program, which is connected to several X-Terminals. If I
    > disconnect one of these X-Terminals, my program gets stuck in an X-
    > call and I see the following stack in the debugger:


    By X-Terminals you mean X-Servers, right ??

    >
    > (gdb) bt
    > #0 0x4030d9f8 in select () from /lib/tls/libc.so.6
    > #1 0x4018a980 in _XGetAsyncData () from /usr/X11R6/lib/libX11.so.6
    > #2 0x4018b148 in _XFlush () from /usr/X11R6/lib/libX11.so.6
    > #3 0x4018af77 in _XFlush () from /usr/X11R6/lib/libX11.so.6
    > #4 0x40170f9c in XFlush () from /usr/X11R6/lib/libX11.so.6
    > #5 0x080600f7 in my-function
    > .
    > .
    >
    > Normally I would have expected to run into an XIO-Error, which I could
    > handle. But it looks, as if my program stucks in the select call,
    > until I reconnect the X-Terminal or until I restart the my program.
    >
    > Has anybody an idea that might help?


    It'll be stuck unless underlying protocol (in your case probably TCP)
    timeouts... So if you're able to tweak underlying protocol's timeout value,
    you'll get notification of disconnection early.

    >
    > Thank you in advance
    >
    > Dieter


    HTH
    - --
    Ashish Shukla आशीष शुक्ल http://wahjava.wordpress.com/
    ·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (GNU/Linux)

    iD8DBQFHW8qIHy+EEHYuXnQRAgUzAJ45wKKWdrr4hI1hYdOxiL FVj5s7JQCfYG9e
    A7fi1p5dk0cP2dOWD+7qIQU=
    =xb+m
    -----END PGP SIGNATURE-----

  3. Re: Captured by X

    Hello Ashish,

    thank you for your anwswer.

    > > I have a program, which is connected to several X-Terminals. If I
    > > disconnect one of these X-Terminals, my program gets stuck in an X-
    > > call and I see the following stack in the debugger:

    >
    > By X-Terminals you mean X-Servers, right ??
    >


    Yes, the X-Server is running on a remote X-Terminal.

    >
    > It'll be stuck unless underlying protocol (in your case probably TCP)
    > timeouts... So if you're able to tweak underlying protocol's timeout value,
    > you'll get notification of disconnection early.
    >


    Yes I think that is the problem. I think I should call
    "setsockopt(socket_id, SOL_SOCKET, SO_KEEPALIVE, ..)" either directly
    or indirectly via a X-lib function.

    Does anybody now, how I can get the socket_id of the X-lib of a
    connected display or whether there exists an X-lib function, which
    allows me to set the socket options?

    Thank you in advance

    Dieter

  4. Re: Captured by X

    Dieter Mller wrote:
    > Hello Ashish,
    >
    > thank you for your anwswer.
    >
    >> > I have a program, which is connected to several X-Terminals. If I
    >> > disconnect one of these X-Terminals, my program gets stuck in an X-
    >> > call and I see the following stack in the debugger:

    >>
    >> By X-Terminals you mean X-Servers, right ??
    >>

    >
    > Yes, the X-Server is running on a remote X-Terminal.
    >
    >>
    >> It'll be stuck unless underlying protocol (in your case probably TCP)
    >> timeouts... So if you're able to tweak underlying protocol's timeout value,
    >> you'll get notification of disconnection early.
    >>

    >
    > Yes I think that is the problem. I think I should call
    > "setsockopt(socket_id, SOL_SOCKET, SO_KEEPALIVE, ..)" either directly
    > or indirectly via a X-lib function.
    >
    > Does anybody now, how I can get the socket_id of the X-lib of a
    > connected display or whether there exists an X-lib function, which
    > allows me to set the socket options?


    The ConnectionNumber macro can be used with a Display * to retrieve the
    fd for the socket.


    George

  5. Re: Captured by X

    On 14 Dez., 02:27, George Peter Staplin
    wrote:
    > Dieter Mller wrote:
    > > Hello Ashish,

    >
    > > thank you for your anwswer.

    >
    > >> > I have a program, which is connected to several X-Terminals. If I
    > >> > disconnect one of these X-Terminals, my program gets stuck in an X-
    > >> > call and I see the following stack in the debugger:

    >
    > >> By X-Terminals you mean X-Servers, right ??

    >
    > > Yes, the X-Server is running on a remote X-Terminal.

    >
    > >> It'll be stuck unless underlying protocol (in your case probably TCP)
    > >> timeouts... So if you're able to tweak underlying protocol's timeout value,
    > >> you'll get notification of disconnection early.

    >
    > > Yes I think that is the problem. I think I should call
    > > "setsockopt(socket_id, SOL_SOCKET, SO_KEEPALIVE, ..)" either directly
    > > or indirectly via a X-lib function.

    >
    > > Does anybody now, how I can get the socket_id of the X-lib of a
    > > connected display or whether there exists an X-lib function, which
    > > allows me to set the socket options?

    >
    > The ConnectionNumber macro can be used with a Display * to retrieve the
    > fd for the socket.
    >
    > George- Zitierten Text ausblenden -
    >
    > - Zitierten Text anzeigen -


    Thank you very much, that was exactly, what I was looking for.

    Dieter

+ Reply to Thread