X11 clients use blocking sockets causing large drawing times

Bug #320150 reported by Mike
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libx11 (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

Binary package hint: libx11-6

Description: Ubuntu 8.04.2
Release: 8.04

libx11-6:
  Installed: 2:1.1.3-1ubuntu2
  Candidate: 2:1.1.3-1ubuntu2
  Version table:
 *** 2:1.1.3-1ubuntu2 0
        500 http://us.archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

Symptoms: very slow drawing times for text strings in X clients, restored to normal if mouse moves over the X client's window while drawing. Originally seen in charts produced in the scilab application, but underlying problem appears to exist in all X clients due to Hardy X11 runtime library problem. This problem did not exist in Gutsy (I recently upgraded).

Cause: strace shows that X clients under Ubuntu 8.04 do not set X client-server socket's TCP_NODELAY option. Therefore X server can potentially wait until X server's timeout before sending ACK packet back to X client. This occurs in some (or all) X text drawing commands which do not require a reply, therefore waiting for the ACK until the next packet happens to be sent from X server back to X client. Under Windows this delay is 200 ms, causing extremely slow drawing times if the window contains a lot of text. ACK delay under Hardy is very small (< 1 ms), making this issue imperceptible when X server is also running (displaying) on a Hardy machine.

Strace run on Ubuntu 8.04 contains this trace for opening the socket to the X server:

6246 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
6246 connect(3, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("192.168.0.14")}, 16) = 0
6246 getpeername(3, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("192.168.0.14")}, [16]) = 0

The same startup on RedHat:

[pid 8014] socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
[pid 8014] setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
[pid 8014] setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
[pid 8014] connect(3, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("192.168.0.14")}, 16) = 0
[pid 8014] getpeername(3, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("192.168.0.14")}, [16]) = 0

Note the lack of setsockopt() calls in Hardy. The missing setsockopt() calls occur in apparently all Hardy X clients, including (for example) xterm, therefore I am *guessing* at this point that the problem occurs in the base X11 client library.

How to duplicate:

strace -f -e trace=network,read,write,open,close -o ./strace.out /usr/bin/scilab -nw
plot(1:10,1:10,'-m');

Notice the very slow drawing times for axes labels (text).

Look in strace.out file for the lines above.

Run same strace command under Gutsy or under other Linux versions (such as RedHat, etc.).

Strace shows the same difference in setsockopt() calls for any other X client starting, such as xterm.

[lspci]
00:00.0 Host bridge [0600]: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller [8086:29c0] (rev 02)
     Subsystem: Micro-Star International Co., Ltd. Unknown device [1462:7338]
01:00.0 VGA compatible controller [0300]: nVidia Corporation G72 [GeForce 7300 SE] [10de:01d3] (rev a1) (prog-if 00 [VGA controller])
     Subsystem: eVga.com. Corp. Unknown device [3842:c428]

Revision history for this message
Bryce Harrington (bryce) wrote :

Hi mike-kleinnet,

Please attach the output of `lspci -vvnn`, and attach your /var/log/Xorg.0.log file from after reproducing this issue. If you've made any customizations to your /etc/X11/xorg.conf please attach that as well.

Please attach the output of `lspci -vvnn` too.

[This is an automated message. If this script has reached you erroneously, please accept our apologies; any reply to this message will be sufficient to prevent it from doing further automated processing.]

Changed in libx11:
status: New → Incomplete
Revision history for this message
Mike (mike-kleinnet) wrote :
Revision history for this message
Mike (mike-kleinnet) wrote :
Revision history for this message
Mike (mike-kleinnet) wrote :
Revision history for this message
Mike (mike-kleinnet) wrote :

I've attached the requested files, although this issue appears to be in the X client libraries, not the server.

Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks; I'm guessing this may be another instance of bug #277069 ? The symptoms sound similar anyway. Can you try running with a non-xcb libx11 and see if that makes the problem go away?

Revision history for this message
Mike (mike-kleinnet) wrote : Re: [Bug 320150] Re: X11 clients use blocking sockets causing large drawing times

Hi Bryce -- I'm not sure what a non-xcb libx11 is... where would I find one and how would I replace it?

Looking over the other related bug reports, it does not seem like the same problem. This one is very specific to X text drawing commands.

  -Mike

On 2/27/2009 10:40 AM, Bryce Harrington wrote:
> Thanks; I'm guessing this may be another instance of bug #277069 ? The
> symptoms sound similar anyway. Can you try running with a non-xcb
> libx11 and see if that makes the problem go away?
>

Bryce Harrington (bryce)
description: updated
Bryce Harrington (bryce)
Changed in libx11 (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Joakim Plate (elupus) wrote :

This is as said a duplicate of bug #277069 and enabling TCP_NODELAY in libxcb fixes the problems. I posted a patch for it on the freedesktup bug mentioned in #277069, and there is a ppa deb packege for it there too.

Bryce Harrington (bryce)
tags: added: hardy
Revision history for this message
bugbot (bugbot) wrote :

This bug report was filed against an old version of Ubuntu.
Can you confirm whether this is still an issue in natty?

If you don't mind, it would be very helpful if you could update the bug
report in launchpad to 'Fix Released' if it is no longer an issue for
you, or if it is still occurring under natty, please tag the bug 'natty'
so it's easier for us to track.

Changed in libx11 (Ubuntu):
status: Confirmed → New
status: New → Incomplete
Revision history for this message
Mike (mike-kleinnet) wrote :
Download full text (4.6 KiB)

I am still using 8.04 so yes, it is still an important issue for me. It is unrealistic to upgrade 5 or 6 versions of Ubuntu just to test this, since upgrading all associated applications, scripts, maintenance methods, etc. would be required.

Please note that this bug was filed over 2 years ago and no progress has been made.

  -Mike

On Apr 27, 2011, at 8:38 PM, bugbot wrote:

> This bug report was filed against an old version of Ubuntu.
> Can you confirm whether this is still an issue in natty?
>
> If you don't mind, it would be very helpful if you could update the bug
> report in launchpad to 'Fix Released' if it is no longer an issue for
> you, or if it is still occurring under natty, please tag the bug 'natty'
> so it's easier for us to track.
>
>
> ** Changed in: libx11 (Ubuntu)
> Status: Confirmed => New
>
> ** Changed in: libx11 (Ubuntu)
> Status: New => Incomplete
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/320150
>
> Title:
> X11 clients use blocking sockets causing large drawing times
>
> Status in “libx11” package in Ubuntu:
> Incomplete
>
> Bug description:
> Binary package hint: libx11-6
>
> Description: Ubuntu 8.04.2
> Release: 8.04
>
> libx11-6:
> Installed: 2:1.1.3-1ubuntu2
> Candidate: 2:1.1.3-1ubuntu2
> Version table:
> *** 2:1.1.3-1ubuntu2 0
> 500 http://us.archive.ubuntu.com hardy/main Packages
> 100 /var/lib/dpkg/status
>
> Symptoms: very slow drawing times for text strings in X clients,
> restored to normal if mouse moves over the X client's window while
> drawing. Originally seen in charts produced in the scilab
> application, but underlying problem appears to exist in all X clients
> due to Hardy X11 runtime library problem. This problem did not exist
> in Gutsy (I recently upgraded).
>
> Cause: strace shows that X clients under Ubuntu 8.04 do not set X
> client-server socket's TCP_NODELAY option. Therefore X server can
> potentially wait until X server's timeout before sending ACK packet
> back to X client. This occurs in some (or all) X text drawing
> commands which do not require a reply, therefore waiting for the ACK
> until the next packet happens to be sent from X server back to X
> client. Under Windows this delay is 200 ms, causing extremely slow
> drawing times if the window contains a lot of text. ACK delay under
> Hardy is very small (< 1 ms), making this issue imperceptible when X
> server is also running (displaying) on a Hardy machine.
>
> Strace run on Ubuntu 8.04 contains this trace for opening the socket
> to the X server:
>
> 6246 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
> 6246 connect(3, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("192.168.0.14")}, 16) = 0
> 6246 getpeername(3, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("192.168.0.14")}, [16]) = 0
>
>
> The same startup on RedHat:
>
> [pid 8014] socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
> [pid 8014] setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
> [pid 8014] setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
> ...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.