Tapestry Web App on Tomcat spits up trash from time to time

We have a Tapestry-Spring-Hibernate webapp running on Tomcat 6 with several thousand requests per second. By chance, for no apparent reason, the page simply displays a bunch of random characters in the browser. However, when the page refreshes, it displays normally. Here is a screenshot of the source of the distorted page in Chrome:

Page from tomcat on Chrome

Here is what I have found so far:

  • This is not like a browser. I have witnessed this in Chrome and Firefox, but users have also reported this in IE 7 and above.
  • The server load does not seem to be relevant to when this happens.
  • Refreshing the page displays the page as usual, as if nothing had happened.
  • I do not see anything important in the server or application logs
  • Content type tag for the page <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
  • Several webapps are deployed in one container, one of which is Alfresco, but they do not seem to show this at all.

My question is: has anyone come across this before, and if so, can they tell me where I should start looking? Is this a problem because the page has something like the wrong type of content or a server that cannot handle it for any reason? Or could it be a frame error in the tapestry or in the application itself? Any pointers are welcome. At the moment, I'm not sure where the problem is, so I was not sure if this was happening on ServerFault or staying here.

+6
source share
3 answers

This seems to be due to gzip compression issues in the Tapestry structure (as @barnyr suggests) and may be a regression error in Tapestry 5.3. To quote Howard from the mailing list :

I believe that this was a mistake in which, under certain circumstances, the corrupt content stream of a GZIP page will be transmitted to the client; this is fixed in 5.2.6, but I thought it was also fixed in 5.2.5.

A quick fix is ​​to add the following configuration character to the contributeApplicationDefaults method of the application module class:

 configuration.add(SymbolConstants.GZIP_COMPRESSION_ENABLED, "false"); 

This, of course, disables gzip compression, but it may be worth the compromise.

Possible problems:

0
source

Most likely, this is a bug in the application. (Most mistakes ... despite the natural tendency of programmers to blame something else.)

However, it can be a little difficult to find this problem. I suggest you start with the standard things:

  • Look at the server error logs to see if anything strange appears when one of these "events" occurs.
  • Check the server access logs to see if you can identify the request that created the garbage data.
  • Turn on your browser debugger and see if you can track the wrong request this way.

If you can figure out which query that triggered a bad answer, you will have more efforts in finding the cause.


FWIW is not like the result of a character encoding problem. This is more like binary or compressed data.

+2
source

Here is one situation that led me to a distorted page. On the error page, Tapestry sets the response header called X-Tapestry-ErrorMessage. Obviously, newlines are not allowed in headings (at least in some browsers), so if there is a new line in this heading, you get gibberish. In one error message that we installed, a new line appeared. I changed it to remove all new lines before setting up this header, and then the error page displayed correctly.

+1
source

Source: https://habr.com/ru/post/916453/


All Articles