Your message dated Mon, 20 Jul 2009 16:21:07 +0200
with message-id <[email protected]>
and subject line Re: UI-Patch: Please fix handling of select timeout errors
has caused the Debian Bug report #510864,
regarding UI-Patch: Please fix handling of select timeout errors
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
510864: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510864
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: pdns
Severity: wishlist
Tags: patch

Hi pdns maintainers,

the attached dpatch

## DP: Fixes handling of select timeout errors.

is used here (UI) to improve pdns. It applies cleanly to 2.9.21.2-1
after the existing dpatches.

We would be enlightened if you could review it and eventually consider 
adding it to the Debian package.      

Thanks!

Stephan

-- System Information:
Debian Release: 5.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
#! /bin/sh /usr/share/dpatch/dpatch-run
## ui-15_select-timeout.patch.dpatch by Stephan Suerken <[email protected]>
##
## All lines beginning with `## DP:' are a description of the patch.
##
## DP: Fixes handling of select timeout errors.

@DPATCH@
diff -urNad trunk~/pdns/misc.cc trunk/pdns/misc.cc
--- trunk~/pdns/misc.cc	2007-04-21 13:56:36.000000000 +0000
+++ trunk/pdns/misc.cc	2009-01-05 13:14:02.000000000 +0000
@@ -292,7 +292,7 @@
     FD_SET( fd, &writefds );
 
   ret = select( fd + 1, &readfds, &writefds, NULL, &tv );
-  if ( ret == -1 )
+  if ( ret == 0 )
     errno = ETIMEDOUT;
 
   return ret;
diff -urNad trunk~/pdns/resolver.cc trunk/pdns/resolver.cc
--- trunk~/pdns/resolver.cc	2007-04-21 13:56:36.000000000 +0000
+++ trunk/pdns/resolver.cc	2009-01-05 13:14:02.000000000 +0000
@@ -263,12 +263,17 @@
   tval.tv_sec=10;
   tval.tv_usec=0;
 
-  if(!select(d_sock+1,&rset,&wset,0,tval.tv_sec ? &tval : 0)) {
-    Utility::closesocket(d_sock); // timeout
+  // FIXED, select error was not handled
+  if((err=select(d_sock+1,&rset,&wset,0,tval.tv_sec ? &tval : 0))<1) {
+    if (err==0)	{ // timeout
+    Utility::closesocket(d_sock);
     d_sock=-1;
     errno=ETIMEDOUT;
     
     throw ResolverException("Timeout connecting to server");
+    } else { // error
+    throw ResolverException("Error connecting to server");
+    }
   }
   
   if(FD_ISSET(d_sock, &rset) || FD_ISSET(d_sock, &wset))
@@ -338,8 +343,9 @@
   unsigned char buf[2];
   
   while(bytesLeft) {
-    int ret=waitForData(d_sock, 10);
-    if(ret<0) {
+    // FIXED, select timeout was not handled
+    int ret=0;
+    if(waitForData(d_sock, 10)<1) {
       Utility::closesocket(d_sock);
       d_sock=-1;
       throw ResolverException("Waiting on data from remote TCP client: "+stringerror());
diff -urNad trunk~/pdns/session.cc trunk/pdns/session.cc
--- trunk~/pdns/session.cc	2007-04-21 13:56:36.000000000 +0000
+++ trunk/pdns/session.cc	2009-01-05 13:14:02.000000000 +0000
@@ -149,13 +149,16 @@
   tval.tv_sec=d_timeout;
   tval.tv_usec=0;
 
-  if(!select(clisock+1,&rset,&wset,0,tval.tv_sec ? &tval : 0))
+  // FIXED, select error was not handled
+  if((err=select(clisock+1,&rset,&wset,0,tval.tv_sec ? &tval : 0))<1)
     {
       Utility::closesocket(clisock); // timeout
       clisock=-1;
-      errno=ETIMEDOUT;
-  
-      throw SessionTimeoutException("Timeout connecting to server");
+      if (err==0) {
+				errno=ETIMEDOUT;
+        throw SessionTimeoutException("Timeout connecting to server");
+      } else
+        throw SessionException("Error connecting to server");
     }
   
   if(FD_ISSET(clisock, &rset) || FD_ISSET(clisock, &wset))
@@ -190,8 +193,9 @@
       tval.tv_sec=d_timeout;
       tval.tv_usec=0;
       
-      if(!select(clisock+1,0,&wset,0,tval.tv_sec ? &tval : 0))
-	throw SessionTimeoutException("timeout writing line");
+      // FIXED, select error was not handled
+      if((err=select(clisock+1,0,&wset,0,tval.tv_sec ? &tval : 0))<1)
+  throw SessionTimeoutException(string(err?"error":"timeout")+" reading");
 
       if(FD_ISSET(clisock, &wset))
 	{
@@ -236,7 +240,8 @@
   
   int err;
   
-  if(!select(clisock+1,&rset,0,0,tval.tv_sec ? &tval : 0))
+  // FIXED, select error was not handled
+  if(select(clisock+1,&rset,0,0,tval.tv_sec ? &tval : 0)<1)
     throw SessionTimeoutException("timeout reading");
   
   if(FD_ISSET(clisock, &rset))

--- End Message ---
--- Begin Message ---
     A. On Mon, 2009-01-05 at 14:58 +0100, Stephan S� wrote:

> ## DP: Fixes handling of select timeout errors.
> 
> is used here (UI) to improve pdns. It applies cleanly to 2.9.21.2-1
> after the existing dpatches.

this patch does not apply any more for upstream 2.9.22, and won't be
updated, so I am closing this bug.

Sorry for the noise,

Stephan
-- 
Stephan Sürken <absurd at debian.org>


--- End Message ---

Reply via email to