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 2015/06/08 05:16:53 UTC

[Bug 58009] New: Trying to forward request to newly created file results in 404 "The requested resource is not available."

https://bz.apache.org/bugzilla/show_bug.cgi?id=58009

            Bug ID: 58009
           Summary: Trying to forward request to newly created file
                    results in 404 "The requested resource is not
                    available."
           Product: Tomcat 8
           Version: 8.0.21
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: mattcoz@yahoo.com

I have a process that builds a zip file, stores it as a temp file, and then
forwards the request to the path of the temp file to deliver it to the user.
This was working in Tomcat 6 and it works on my test server which is running
Tomcat 8.0.3, but when deploying on the live server which is running Tomcat
8.0.21 it gives me a 404 response saying "The requested resource is not
available." The path to the file is correct, if I manually access the path I
get the file. Actually, if try to access it very quickly I will get the 404
response but then get the file if I try again. It seems that the newly created
file is not immediately found by Tomcat, like there's a delay of a few seconds.
Could this be a regression caused by the static resource cache changes in
Tomcat 8.0.10?

-- 
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 58009] Trying to forward request to newly created file results in 404 "The requested resource is not available."

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEEDINFO                    |RESOLVED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
No test case has been provided. Further, the WebResourceRoot already contains
methods for adding resources that correctly interacts with caching if caching
is enabled. It is used, for example, with HTTP PUT.

The Servlet API provides no standard mechanisms for writing new resources (it
doesn't even assume that the web application is served from a file system) so
you are always going to have to work wth some form of container specific
interface.

In Tomcat the options are:
- disable caching
- don't try to access the file before you try to write to it
- use WebResourceRoot.write(String, InputStream, boolean)

-- 
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 58009] Trying to forward request to newly created file results in 404 "The requested resource is not available."

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

Remy Maucherat <re...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
                 OS|                            |All

--- Comment #1 from Remy Maucherat <re...@apache.org> ---
There's a resource cache, so if you create - or delete, modify, etc - a file
using direct file access, then you can get stale data. In some situations,
there's no workaround except disable the cache. The new cache may be caching
more than the previous one, causing the new behavior.

Please provide a test case to investigate further.

-- 
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 58009] Trying to forward request to newly created file results in 404 "The requested resource is not available."

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

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
'Not found' results are cached as well. I suspect the application code is
checking that the file exists, discovering that it doesn't (which is cached),
ading the file (outside of the WebResources impl) and the trying to access at
which point it is seeing the cached 'not found' response.

It may be possible to fix the application to avoid triggering the addition of
the resource to the cache as 'not found'. Maybe the answer is extending the
WebResources API to include creation of resources. There are probably other
solutions as well. A simple test case that demonstrates the issue would enable
us to evaluate the different possible solutions.

-- 
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 58009] Trying to forward request to newly created file results in 404 "The requested resource is not available."

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

--- Comment #2 from Matt <ma...@yahoo.com> ---
Actually, after restarting the test server I'm getting the same behavior there,
so the regression is not in 8.0.10. Disabling the resource cache does fix it,
but that doesn't seem to be ideal. If the file is not found in the cache,
shouldn't it try to retrieve the file normally?

-- 
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 58009] Trying to forward request to newly created file results in 404 "The requested resource is not available."

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

--- Comment #5 from Christopher Schultz <ch...@christopherschultz.net> ---
One more option: write a new servlet to serve your new files off the filesystem
instead of relying on DefaultServlet to do it for you.

While this strategy will work, it's easy to do it wrong, or fail to implement
nice features like Range requests, ETag/IfModifiedSince/etc.

-- 
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