[Xcb] [SRM] proposed upload of libxcb to lenny

Julien Cristau jcristau at debian.org
Wed May 27 11:32:25 PDT 2009


Hi,

some bugs in libxcb cause Xlib performance regressions in lenny.  Those
seem to hit ltsp users in particular pretty badly, so I'd like to fix
this in a stable update.

Proposed debdiff follows, with the following changes:
- use a 16k buffer instead of 4k; this is maybe not strictly necessary,
  but would make lenny's version consistent with both traditional Xlib
  (as used in etch and before) and recent libxcb (>= 1.2)
- disable the Nagle algorithm for TCP sockets; this one would make
  latency on tcp sockets pretty horrible
- a few file descriptor leaks in connect error paths, which I included
  mostly because it made cherry-picking the TCP_NODELAY patch easier

Cheers,
Julien

 libxcb-1.1/debian/changelog |   10 ++++++++++
 src/xcb_util.c              |   21 ++++++++++++++++-----
 src/xcbint.h                |    2 +-
 3 files changed, 27 insertions(+), 6 deletions(-)

diff -u libxcb-1.1/debian/changelog libxcb-1.1/debian/changelog
--- libxcb-1.1/debian/changelog
+++ libxcb-1.1/debian/changelog
@@ -1,3 +1,13 @@
+libxcb (1.1-1.2) stable; urgency=low
+
+  * Non-maintainer upload to fix important performance issues
+    (closes: #487635).
+  * Fix some fd leaks in _xcb_open_*()
+  * Increase libxcb buffer size to 16k from 4k
+  * Disable Nagle on TCP socket
+
+ -- Julien Cristau <jcristau at debian.org>  Wed, 27 May 2009 20:06:47 +0200
+
 libxcb (1.1-1.1) unstable; urgency=low
 
   * Non-maintainer upload.
only in patch2:
unchanged:
--- libxcb-1.1.orig/src/xcbint.h
+++ libxcb-1.1/src/xcbint.h
@@ -72,7 +72,7 @@
     pthread_cond_t cond;
     int writing;
 
-    char queue[4096];
+    char queue[16384];
     int queue_len;
 
     unsigned int request;
only in patch2:
unchanged:
--- libxcb-1.1.orig/src/xcb_util.c
+++ libxcb-1.1/src/xcb_util.c
@@ -30,6 +30,7 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #ifdef DNETCONN
 #include <netdnet/dnetdb.h>
 #include <netdnet/dn.h>
@@ -192,8 +193,10 @@
     accessdata.acc_accl = strlen((char *)accessdata.acc_acc);
     setsockopt(fd, DNPROTO_NSP, SO_CONACCESS, &accessdata, sizeof(accessdata));
 
-    if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
+    if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
+        close(fd);
         return -1;
+    }
     return fd;
 }
 #endif
@@ -233,9 +236,15 @@
     for(addr = results; addr; addr = addr->ai_next)
     {
         fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
-        if(fd >= 0 && connect(fd, addr->ai_addr, addr->ai_addrlen) >= 0)
-            break;
-        fd = -1;
+        if(fd >= 0) {
+            int on = 1;
+            setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
+
+            if (connect(fd, addr->ai_addr, addr->ai_addrlen) >= 0)
+                break;
+            close(fd);
+            fd = -1;
+        }
     }
     freeaddrinfo(results);
     return fd;
@@ -254,8 +263,10 @@
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
     if(fd == -1)
         return -1;
-    if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
+    if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
+        close(fd);
         return -1;
+    }
     return fd;
 }
 


More information about the Xcb mailing list