You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Chia-liang Kao <cl...@CirX.ORG> on 2000/02/20 15:53:31 UTC

[PATCH] writev problem

I just found that apache-2.0 would not serve (not so) large files from
default_handler. (htdocs/index.html is okay, but htdocs/hooks.html cause
it to eat up all CPU.

The problem is the wrong parameter forwarding in writev_with_errors...
If iol_writev would like tak ap_iovec_t, it must dereference ap_iovec_t
to get iov->theiov for ap_sendv. (And I guess ap_iovec_t is supposed to
be wrapped within apr)

It seemed that other os/*/iol_socket would work with this patch.

RCS file: /cvs/apache/apache-2.0/src/include/ap_iol.h,v
retrieving revision 1.10
diff -u -r1.10 ap_iol.h
--- ap_iol.h	2000/02/18 18:05:15	1.10
+++ ap_iol.h	2000/02/20 14:40:25
@@ -106,7 +106,7 @@
     ap_status_t (*close)(ap_iol *fd);
     ap_status_t (*write)(ap_iol *fd, const char *buf, ap_size_t len,
                          ap_ssize_t *nbytes);
-    ap_status_t (*writev)(ap_iol *fd, const ap_iovec_t *vec, int nvec,
+    ap_status_t (*writev)(ap_iol *fd, const struct iovec *vec, int nvec,
                           ap_ssize_t *nbytes);
     ap_status_t (*read)(ap_iol *fd, char *buf, ap_size_t len,
                         ap_ssize_t *nbytes);
Index: lib/apr/locks/unix/crossproc.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/main/buff.c,v
retrieving revision 1.30
diff -u -r1.30 buff.c
--- buff.c	2000/02/18 18:05:19	1.30
+++ buff.c	2000/02/20 14:40:47
@@ -556,8 +556,7 @@
 {
     ap_status_t rv;
-    ap_iovec_t *iov;
-    ap_make_iov(&iov, vec, fb->pool);
-    rv = iol_writev(fb->iol, iov, nvec, bytes_written);
+    rv = iol_writev(fb->iol, vec, nvec, bytes_written);
     if (rv != APR_SUCCESS) {
 	fb->saved_errno = rv;
 	if (rv != APR_EAGAIN) {

Re: [PATCH] writev problem

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
I'm working on this now. Will commit a fix with-in an hour or so.

Bill
----- Original Message ----- 
From: Chia-liang Kao <cl...@CirX.ORG>
To: <ne...@apache.org>
Sent: Sunday, February 20, 2000 9:53 AM
Subject: [PATCH] writev problem


> I just found that apache-2.0 would not serve (not so) large files from
> default_handler. (htdocs/index.html is okay, but htdocs/hooks.html cause
> it to eat up all CPU.
> 
> The problem is the wrong parameter forwarding in writev_with_errors...
> If iol_writev would like tak ap_iovec_t, it must dereference ap_iovec_t
> to get iov->theiov for ap_sendv. (And I guess ap_iovec_t is supposed to
> be wrapped within apr)
> 
> It seemed that other os/*/iol_socket would work with this patch.
> 
> RCS file: /cvs/apache/apache-2.0/src/include/ap_iol.h,v
> retrieving revision 1.10
> diff -u -r1.10 ap_iol.h
> --- ap_iol.h 2000/02/18 18:05:15 1.10
> +++ ap_iol.h 2000/02/20 14:40:25
> @@ -106,7 +106,7 @@
>      ap_status_t (*close)(ap_iol *fd);
>      ap_status_t (*write)(ap_iol *fd, const char *buf, ap_size_t len,
>                           ap_ssize_t *nbytes);
> -    ap_status_t (*writev)(ap_iol *fd, const ap_iovec_t *vec, int nvec,
> +    ap_status_t (*writev)(ap_iol *fd, const struct iovec *vec, int nvec,
>                            ap_ssize_t *nbytes);
>      ap_status_t (*read)(ap_iol *fd, char *buf, ap_size_t len,
>                          ap_ssize_t *nbytes);
> Index: lib/apr/locks/unix/crossproc.c
> ===================================================================
> RCS file: /cvs/apache/apache-2.0/src/main/buff.c,v
> retrieving revision 1.30
> diff -u -r1.30 buff.c
> --- buff.c 2000/02/18 18:05:19 1.30
> +++ buff.c 2000/02/20 14:40:47
> @@ -556,8 +556,7 @@
>  {
>      ap_status_t rv;
> -    ap_iovec_t *iov;
> -    ap_make_iov(&iov, vec, fb->pool);
> -    rv = iol_writev(fb->iol, iov, nvec, bytes_written);
> +    rv = iol_writev(fb->iol, vec, nvec, bytes_written);
>      if (rv != APR_SUCCESS) {
>   fb->saved_errno = rv;
>   if (rv != APR_EAGAIN) {