Bug 107982 - handler's behavior is strange when handler returns error
Summary: handler's behavior is strange when handler returns error
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: httpd
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Joe Orton
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-10-25 15:22 UTC by maya
Modified: 2007-04-18 16:58 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-11-17 05:01:34 UTC
Embargoed:


Attachments (Terms of Use)
sample code (2.15 KB, text/plain)
2003-10-27 03:53 UTC, maya
no flags Details
Patch for re-creation (944 bytes, patch)
2003-11-13 08:22 UTC, maya
no flags Details | Diff

Description maya 2003-10-25 15:22:09 UTC
Description of problem:
Return error in a handler, but go to next hander instead of go to logging phase.

Version-Release number of selected component (if applicable):
httpd-2.0.40-21.5.i386.rpm

Steps to Reproduce:
1. Install httpd-2.0.40-21.5.i386.rpm and httpd-devel-2.0.40-21.5.i386.rpm
from ftp://updates.redhat.com/9/en/os/i386/.
2. Generate a module by `apxs -g -n overrun' command, and write
mod_overrun.c. Please see link of URL section.
3. Install this module and add follwings to httpd.conf:
  LoadModule overrun_module modules/mod_overrun.so
  <Location /somewhere>
    SetHander overrun
  </Loacation>
4. Access to `http://hostname/somewhere/.'

Actual results:
The `OK' message and the `NG' message appears in the error log
which wirtten by overrun_access_checker.

Expected results:
The `NG' message is not appears in the error log.
Only the `OK' message is appears.

Additional info:
I compiled httpd-2.0.47 manually `./configure; make; make install' and
tryed same module, but above problem was not appeared.
/usr/sbin/httpd in httpd-2.0.40-21.5.i386.rpm is borken?

Comment 1 maya 2003-10-27 03:53:39 UTC
Created attachment 95502 [details]
sample code

Comment 2 maya 2003-10-27 05:09:59 UTC
I moved to sample code sample code to `Attachment' and updated it.
I'm sorry to I didn't attach and comment at same time.

I set some value to request_rec->notes in the first handler and return error,
control is moved to next handler (this is bug) and if code accesses to
request_rec->notes then value will lost.
If code accesses to the value without check for NULL (it is negligence but)
then Segmentation fault will occurs.

Comment 3 maya 2003-11-13 08:22:11 UTC
Created attachment 95939 [details]
Patch for re-creation

I checked the source code of httpd-2.0.40 and found
the place of problem in server/request.c.

I think that the httpd have to return from `ap_process_request_internal'
when `ap_run_translate_name' returns 404(it is a return code from module)
in `ap_process_request_internal'.
But httpd goes through next steatment for unknown reason.
I could not trace the Apache source code moreover.

Please try attached patch(it is not for solving the problem.
it is for re-creation.) and previous attached module at once.

Comment 4 Joe Orton 2003-11-13 10:57:55 UTC
I can't reproduce a problem here.  The translate_name hook is run,
writes the log entry, and returns HTTP_NOT_FOUND, and that is what is
sent to the client.

The access_check hook is never run, as expected.

Comment 5 maya 2003-11-15 14:22:36 UTC
I tryed to update glibc and kernel, but problem was not solved.

Then I installed Red Hat 9 other machine and try the
first module, but the problem appeared again.
My environment is:
OS       Red Hat 9
httpd    2.0.40-21.5
kernel   2.4.20-20.9
glibc    2.3.2-27.9.7
gcc      3.2.2-5
libtool  1.4.3-5
make     3.79.1-17
automake 15-1.5-6
         14-1.4p6-5.1
         1.6.3-5
autoconf 2.57-3

Please let me know the difference between above and
the environment that the problem not happened.

Comment 6 maya 2003-11-17 05:00:36 UTC
The reason of this problem is a setting in httpd.conf.
Error document is set in httpd.conf from httpd-2.0.40-21.5.rpm.
When a handler returns a HTTP error then httpd request to the error 
document file again. This second request cause this problem.

I skipped this problem by follwoing procedure:
-     ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
+ #   ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

Sorry. It's not rpm's problem.


Note You need to log in before you can comment on or make changes to this bug.