Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366153

Summary: CPU rise and never going down.
Product: [RT] Jetty Reporter: chenchuanfeng <chenchuanfeng001>
Component: serverAssignee: Jan Bartel <janb>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: janb, jetty-inbox
Version: unspecified   
Target Milestone: 7.5.x   
Hardware: All   
OS: All   
Whiteboard:

Description chenchuanfeng CLA 2011-12-09 04:06:03 EST
Build Identifier: 9.0-20110318

I write a servet and deploy it to the jetty server(version:jetty-distribution-8.0.0.v20110901).
when I access this servlet,the cpu rise to a high level and never going down.
The servlet source is:
public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		PrintWriter out = response.getWriter();
	        response.addHeader("Content-Length", "3");
		out.println("abcde");
		out.flush();
		out.close();
} 
This issue would happen when I use println() method and the Content-Length value is less than the real bytes printed.


Reproducible: Always

Steps to Reproduce:
1.write a servlet using the code above
2.deploy the web project to jetty
3.using browser to access this servlet
Comment 1 Jan Bartel CLA 2011-12-09 18:33:01 EST
Hi,

I tested this against the latest release of jetty-8, which is 8.1.0.RC1 and this does not occur (any more). The HttpOutput.write method checks to see if the amount that is written is equal to the content length and closes if so, so it won't try and write more than that amount of data.

regards
Jan