You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2012/07/30 15:41:28 UTC

[Bug 53621] New: Response code incorrect for requests to contexts in stopped state.

https://issues.apache.org/bugzilla/show_bug.cgi?id=53621

          Priority: P2
            Bug ID: 53621
          Assignee: dev@tomcat.apache.org
           Summary: Response code incorrect for requests to contexts in
                    stopped state.
          Severity: normal
    Classification: Unclassified
                OS: Linux
          Reporter: KyleJHarper@gmail.com
          Hardware: PC
            Status: NEW
           Version: 7.0.26
         Component: Catalina
           Product: Tomcat 7

Overview:
When a request is made to a valid location inside of a context while the
context is stopped (either crashed or manually stopped) tomcat will return HTTP
status code 404.

Steps to Reproduce:
Simply create a context (e.g.: /foo) with a page in it.  View the page, stop
the context (I used probe), refresh the page.  Tomcat will return the mapped
404 handler.  I have tested this on 6.0.24 as well as 7.0.26.

Actual vs. Expected Results:
I expected to receive a form of "unavailable" error returned.


The context and page are not unknown to Tomcat, they are simply unavailable.  I
believe the HTTP Status code 503 would be more aptly suited here.

I found this behavior while attempting to enable the Apache2 mod_proxy
failonstatus attribute to be set to 503, to remove BalancerMembers on a
per-ProxyPass level (potentially, per context).  This would be a nice benefit
to the clustering/balancing systems already in place with Tomcat and Apache
HTTPD.

Thanks,
Kyle

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53621] Response code incorrect for requests to contexts in stopped state.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53621

--- Comment #2 from Konstantin Kolinko <kn...@gmail.com> ---
Note that
1. A stopped application is effectively absent from Tomcat and its request
Mapper.

The request is thus served by whatever other web application that is available
for that request path, the common fallback being the ROOT web application.

If you configure a filter or servlet in the ROOT web application to serve 503
response for those requests, that will fulfill your requirement. I remember
this having been discussed on the users list about a month ago.


2. Your issue has to be distinguished from bug 53024. The latter talks about
paused web applications (a state when an application is reloaded) and was a
valid issue. It was fixed in 7.0.28.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53621] Response code incorrect for requests to contexts in stopped state.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53621

--- Comment #3 from Kyle Harper <Ky...@gmail.com> ---
Regarding RFC 2616 and 4xx vs. 5xx codes, I agree that 4xx is more appropriate.
 I'm not sure I agree that 404 is the best option as it lacks information for
the client, but given Konstantin's remark #1 "A stopped context is absent to
tomcat", it makes sense.

I did bring this to the users group via email and the solution of adding a
servlet in the ROOT context to handle mappings for contexts in the stopped
state was suggested.  I implemented this and it works in 7.0.26, and does not
work in 6.0.35.  Here is a link to the archive for that issue:
http://markmail.org/thread/wk7d5zxkp2lsflmz
(I can open a different bug for 6.0.35 Request Mapper not falling back to /ROOT
if you wish to patch 6.x.)

>1. A stopped application is effectively absent from Tomcat and its request 
>Mapper.

Given this, tomcat is working as intended.  Leaving bug resolved:invalid.  If
time permits I'll research a patch to enable configurable status codes in
stopped states.

Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53621] Response code incorrect for requests to contexts in stopped state.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53621

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Reading RFC 2616 any one of several error codes may be appropriate (404, 410,
503). Tomcat has no way of knowing the circumstances and therefore no way of
determining which code is most appropriate. Given this, 404 is a reasonable
default.

My reading of the RFC is that the 400 series of codes is more appropriate than
the 500 series in this case.

If you would like to re-open this as an enhancement request to make the
returned code configurable in this case then please feel free to do so.
Enhancement requests with patches are more likely to be implemented than those
without.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org