On 23/04/2019 16:29, Olivier Jaquemet wrote:
> On 23/04/2019 16:12, Christopher Schultz wrote:
>> On 4/23/19 05:58, Olivier Jaquemet wrote:

<snip/>

>>> * Add the following directive to context.xml : <Resources
>>> cachingAllowed="false" />
>> Okay. Why context.xml, by the way?
> I don't even know (yet...) why this setting was added in the first place
> in the environment where it was present... !
> so why this file... I don't know either :)

DefaultServlet is assuming caching is in place. If you disable it, you
hit this issue.

>>> * Create a large file in the samples webapp, for example : cd
>>> webapps/examples dd if=/dev/zero of=large.txt bs=1k count=2000000

<snip/>

>> Reading the code for FileResource.getContent, it's clear that the
>> entire file is being loaded into memory, which obviously isn't going
>> to work, here. I'm wondering why that's happening since streaming is
>> the correct behavior when caching=false. Also strange is that
>> DefaultServlet will attempt to call FileResource.getContent() -- which
>> returns a byte[] -- and, if that returns null, it will call
>> FileResource.getInputStream which ... calls this.getContent. So this
>> looks like a special-case for FileResource just trying to implement
>> that interface in the simplest way possible.

It is assuming it is working with a CachedResource instance rather than
directly with a FileResource instance.

>> FileResource seems to implement in-memory caching whether it's enabled
>> or not.
>>
>> I can't understand why this doesn't fail for the other kind of
>> connector. Everything else is the same? You have two separate
>> connectors in one instance, or are you changing the connector between
>> tests?
> 
> Everything is exactly the same as I have only one instance with two
> separate connectors (AJP+HTTP).

I suspect HTTP avoids it because sendfile is enabled.

The DefaultServlet logic needs a little refactoring.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to