You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1996/11/19 02:15:37 UTC

Re: mod_cgi.c:325 if (len_read==0) break;

Thanks for the info. Aapche 1.2b1 will be out real soon. I don't think
this code has survived from 1.1.1


cheers,
rob

Tom Brown wrote:
>
>
>Looks to me like it should be:
>
>if(len_read <=0) break;
>
>read_client_block() can return the output from bread() which can be -1 on a=
>n=20
>error... The =0 test doesn't account for that.
>
>
>Please find attached a bit of gdb output from a session on a 'live one' ...
>
>Version stuff;
>
>Apache 1.1.1
>linux 1.2.13=20
>with about 150 virtuals :-) Nothing special=20
>
>One client has a busy chat page that's run through the cgi_wrapper ...=20
>and every once in a while a child process goes AWOL, so I recompiled with
>-g this AM and caught one this afternoon...  Here's the lowdown.=20
>
>----------------------------------------------------------------------
>tbrown@BareMetal.com    (604) 598-7708    http://BareMetal.com/
>Virtual WWW servers -- Advanced WWW tools & Internet consulting
>
>---------- Forwarded message ----------
>Date: Mon, 18 Nov 1996 15:44:48 -0800
>From: Root user <ro...@baremetal.com>
>To: tbrown@baremetal.com
>Subject: backtrace on looping httpd.debug
>
>
>/usr/var/www/bin/14616: No such file or directory.
>Attaching to program `/usr/var/www/bin/httpd.debug', process 14616
>read_client_block (r=3D0x420dc, buffer=3D0xbfffdb50 "=DC \004", bufsiz=3D98=
>)
>    at http_protocol.c:746
>746         return bread(r->connection->client, buffer, bufsiz);
>(gdb) bt
>#0  read_client_block (r=3D0x420dc, buffer=3D0xbfffdb50 "=DC \004", bufsiz=
>=3D98)
>    at http_protocol.c:746
>#1  0x15912 in cgi_handler (r=3D0x420dc) at mod_cgi.c:324
>#2  0x5355 in invoke_handler (r=3D0x420dc) at http_config.c:282
>#3  0x6f6b in process_request_internal (r=3D0x420dc) at http_request.c:768
>#4  0x6f96 in process_request (r=3D0x420dc) at http_request.c:777
>#5  0x2678 in child_main (child_num_arg=3D8) at http_main.c:1247
>#6  0x27b2 in make_child (server_conf=3D0x2b034, child_num=3D8) at http_mai=
>n.c:1293
>#7  0x2d8a in standalone_main (argc=3D3, argv=3D0xbffffca0) at http_main.c:=
>1463
>#8  0x2f71 in main (argc=3D3, argv=3D0xbffffca0) at http_main.c:1529
>(gdb)=20
>
>(gdb) step
>bread (fb=3D0x36034, buf=3D0xbfffdb50, nbyte=3D98) at buff.c:184
>184         if (fb->flags & B_RDERR) return -1;
>(gdb)=20
>252     }
>(gdb)=20
>read_client_block (r=3D0x420dc, buffer=3D0xbfffdb50 "=DC \004", bufsiz=3D98=
>)
>    at http_protocol.c:747
>747     }
>(gdb)=20
>cgi_handler (r=3D0x420dc) at mod_cgi.c:325
>325                 if (len_read =3D=3D 0) break;
>(gdb) list 320
>315
>316             /* If script stopped reading early, soak up remaining stuff=
> from
>317              * client...
>318              */
>319
>320             while (remaining > 0) {
>321                 int len_read, len_to_read =3D remaining;
>322                 if (len_to_read > HUGE_STRING_LEN) len_to_read =3D HUGE=
>_STRING_LEN;
>323                =20
>324                 len_read =3D read_client_block (r, argsbuffer, len_to_r=
>ead);
>(gdb)=20
>325                 if (len_read =3D=3D 0) break;
>326             }
>327        =20
>328             fflush (script_out);
>329             signal (SIGPIPE, handler);
>330
>331             kill_timeout (r);
>332         }
>333     #endif   =20
>334        =20
>
>(gdb)=20
>read_client_block (r=3D0x420dc, buffer=3D0xbfffdb50 "=DC \004", bufsiz=3D98=
>)
>    at http_protocol.c:746
>746         return bread(r->connection->client, buffer, bufsiz);
>(gdb)=20
>bread (fb=3D0x36034, buf=3D0xbfffdb50, nbyte=3D98) at buff.c:184
>184         if (fb->flags & B_RDERR) return -1;
>(gdb)=20
>252     }
>(gdb) prit fb->flags
>Undefined command: "prit".  Try "help".
>(gdb) print fb->flags
>$1 =3D 19
>
>
>[root@aluminum:/usr/src/redhat/BUILD/apache_1.1.1/src]# !grep
>grep B_RDERR *.h *.c
>buff.h:#define B_RDERR (16)
>=20
>So that's it... change the len =3D=3D0 to len <=3D 0 and we're done!
>
>


-- 
Rob Hartill.       Internet Movie Database Ltd.    http://www.imdb.com/