You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Charith Paranaliyanage <ch...@intervest.lk> on 2018/01/29 10:01:34 UTC

Server returns different size of the resource

Hi All,

I am running a web application using spring 4 in tomcat 8.5.8. There were
few errors in the log for "response has already been committed". These were
recorded for both spring controller urls and for some resources.

One exception as follows

2018-01-26 09:25:54 ERROR
org.springframework.boot.web.support.ErrorPageFilter.java
Line 213: Cannot forward to error page for request
[/resources/js/public.js] as the response has already been committed. As a
result, the response may have the wrong status code. If your application is
running on WebSphere Application Server you may be able to resolve this
problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false

When I check the apache logs it indicated as below,

10.30.16.85 - - [26/Jan/2018:09:25:56 +0000] "GET
/resources/js/public.js?relversion=3.0.1.8 HTTP/1.1" 200 49023

But, the actual size of this js file is 65072 and other successful requests
have returned the correct byte amount. For these erroneous responses http
code is 200 and size is different to each other.

How can this happen and is there a way to reproduce this in a development
environment?
Regards,
Charith

Re: Server returns different size of the resource

Posted by Mark Thomas <ma...@apache.org>.
On 29/01/18 10:01, Charith Paranaliyanage wrote:
> Hi All,
> 
> I am running a web application using spring 4 in tomcat 8.5.8. There were
> few errors in the log for "response has already been committed". These were
> recorded for both spring controller urls and for some resources.
> 
> One exception as follows
> 
> 2018-01-26 09:25:54 ERROR
> org.springframework.boot.web.support.ErrorPageFilter.java
> Line 213: Cannot forward to error page for request
> [/resources/js/public.js] as the response has already been committed. As a
> result, the response may have the wrong status code. If your application is
> running on WebSphere Application Server you may be able to resolve this
> problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false
> 
> When I check the apache logs it indicated as below,
> 
> 10.30.16.85 - - [26/Jan/2018:09:25:56 +0000] "GET
> /resources/js/public.js?relversion=3.0.1.8 HTTP/1.1" 200 49023
> 
> But, the actual size of this js file is 65072 and other successful requests
> have returned the correct byte amount. For these erroneous responses http
> code is 200 and size is different to each other.
> 
> How can this happen and is there a way to reproduce this in a development
> environment?

Best guess is that a client aborted the request before Tomcat had
completely sent it.

To reproduce this try writing a test client that requests the resource,
reads the first 1k and then closes the connection. Providing that the
resource is larger than the network buffers, you should see some sort of
error on the Tomcat side - probably an IOException. How the application
handles that is up to the application.

Mark

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