Internet Explorer Restart and the ClientAbortException
We decided to follow the Spring framework's recommendation of changing the url path to the resources each time we pushed a new release, and we ended up injecting the applications version number (pulled from the POM file) into the url. This forced the browser to download new resource files (.js, .css, etc) after an update from an uncached source and was a very dependable solution to cache busting. Our paths changed from
The files did not physically change location on the server (they always remained at /resources/js/file.js), so we needed to route the requests through the servlet context so we could dynamically map the requested path to the actual file.
This approach worked great, and people were happy. Then we started seeing ClientAbortExceptions in our logs, without any error reports from users. ClientAbortExceptions are thrown from tomcat when a http request is terminated by the client while the response is being sent to the client. An even bigger problem for me was that my internet searches revealed that very few people experienced this exception and nobody had a solution for it.
After rolling up my sleeves and investigating the problem further, I eventually found some patterns:
- Only occurred while using internet explorer (of course, right?)
- The exception was never thrown when a page was loaded with a fresh cache, but would always happen after.
- I noticed in the logs that many exceptions were thrown in a row
This started feeling like a client side problem instead of a server side problem, and after searching a little more about this behavior, i found one msdn blog post, describing why Internet Explorer aborts and restarts connections.
In short, what resolved the exception was to change the order of the meta tags in my head section, something i never thought would affect a web page's performance. The optimal order of html tags is:
<meta http-equiv content-type charset>
<meta http-equiv x-ua-compatible>
<title, favicon, comments, script blocks, etc>
Keep these meta tags in the beginning of the <head> tag. Apparently in modern versions of internet explorer they need to be in the first 4kb of the page, otherwise they are ignored. After making the changes, i noticed the exceptions in our log files started disappearing, as well as other IE warnings that I've overlooked in the past (HTML1115, HTML1113 warnings).