You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by St...@nokia.com on 2001/03/06 09:35:49 UTC

Patch for jk_sockbuf.c

These changes fixes the following problem:
When using ajp12 with mod_jk, httpd procesess handling a request 
will hang, using all cpu time, if tomcat is shut down before the headers
of the request have been sent from tomcat.

BR,
Stefan Åberg

***
/usr/local/src/apache/jakarta-tomcat-3.2.1-src/src/native/jk/jk_sockbuf.c
Tue Mar  6 10:10:40 2001
--- jk_sockbuf.c	Tue Mar  6 10:15:54 2001
***************
*** 131,137 ****
  
          if(sb->end == sb->start) {
              sb->end = sb->start = 0;
!             if(!fill_buffer(sb)) {
                  return JK_FALSE;
              }
          }
--- 131,137 ----
  
          if(sb->end == sb->start) {
              sb->end = sb->start = 0;
!             if(fill_buffer(sb) < 0) {
                  return JK_FALSE;
              }
          }
***************
*** 169,175 ****
                      return JK_TRUE;
                  }
              }
!             if(!fill_buffer(sb)) {
                  return JK_FALSE;
              }
          }
--- 169,175 ----
                      return JK_TRUE;
                  }
              }
!             if(fill_buffer(sb) <= 0 ) {
                  return JK_FALSE;
              }
          }
***************
*** 205,215 ****
                 SOCKBUF_SIZE - sb->end, 0);   
  
      if(ret < 0) {
!         return JK_FALSE;
      } 
  
      sb->end += ret;
  
!     return JK_TRUE;
  }
- 
--- 205,214 ----
                 SOCKBUF_SIZE - sb->end, 0);   
  
      if(ret < 0) {
!         return ret;
      } 
  
      sb->end += ret;
  
!     return ret;
  }

Re: Patch for jk_sockbuf.c

Posted by Dan Milstein <da...@shore.net>.
Stefan,

Thanks for looking into this, but this bug has already been fixed in the 32
branch under cvs.  If you check out the most recent version of tomcat_32, or
if you download 3.2.2b1, you can see that jk_sockbuf.c has been cleaned up
(Brian Vetter contributed the patch).

Thanks, though,
-Dan

p.s. For future patches, it would be very, very helpful if you could:

 a) Use cvs diff -u, to get the diffs in the "unified" format, which patch
can read.

 b) Attach your patches to your emails rather than pasting them in -- they
are much less likely to get mangled by email readers.

Stefan.Aberg@nokia.com wrote:
> 
> These changes fixes the following problem:
> When using ajp12 with mod_jk, httpd procesess handling a request
> will hang, using all cpu time, if tomcat is shut down before the headers
> of the request have been sent from tomcat.
> 
> BR,
> Stefan Åberg
> 
> ***
> /usr/local/src/apache/jakarta-tomcat-3.2.1-src/src/native/jk/jk_sockbuf.c
> Tue Mar  6 10:10:40 2001
> --- jk_sockbuf.c        Tue Mar  6 10:15:54 2001
> ***************
> *** 131,137 ****
> 
>           if(sb->end == sb->start) {
>               sb->end = sb->start = 0;
> !             if(!fill_buffer(sb)) {
>                   return JK_FALSE;
>               }
>           }
> --- 131,137 ----
> 
>           if(sb->end == sb->start) {
>               sb->end = sb->start = 0;
> !             if(fill_buffer(sb) < 0) {
>                   return JK_FALSE;
>               }
>           }
> ***************
> *** 169,175 ****
>                       return JK_TRUE;
>                   }
>               }
> !             if(!fill_buffer(sb)) {
>                   return JK_FALSE;
>               }
>           }
> --- 169,175 ----
>                       return JK_TRUE;
>                   }
>               }
> !             if(fill_buffer(sb) <= 0 ) {
>                   return JK_FALSE;
>               }
>           }
> ***************
> *** 205,215 ****
>                  SOCKBUF_SIZE - sb->end, 0);
> 
>       if(ret < 0) {
> !         return JK_FALSE;
>       }
> 
>       sb->end += ret;
> 
> !     return JK_TRUE;
>   }
> -
> --- 205,214 ----
>                  SOCKBUF_SIZE - sb->end, 0);
> 
>       if(ret < 0) {
> !         return ret;
>       }
> 
>       sb->end += ret;
> 
> !     return ret;
>   }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-dev-help@jakarta.apache.org

-- 

Dan Milstein // danmil@shore.net