File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes java.io.Exception , Broken pipe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "java.io.Exception , Broken pipe" Watch "java.io.Exception , Broken pipe" New topic
Author

java.io.Exception , Broken pipe

Cesar Tg.
Greenhorn

Joined: Jul 05, 2004
Posts: 16
Hi Servlets Gurus!

I developed an application, it's a servlet that receives files and process
according to bussiness rules, the problem is that in Java Application Server Logs, there are messages like this:

java.io.Exception : Broken pipe or Connection reset by peer and
it's on logs lot of times, i know the problem is due to servlet doesn't find
where to write the response, (maybe users hit on refresh, close the browser or something like this)

According to Servers administrator, this sessions aren't destroyed and are present on the JAS and consumes resources on CPU or others, IS IT POSSIBLE???

so from time to time Administrator has to restart the JAS to free those resources, and so the application has a good performance...


if this sessions represent a problem, what can i do to solve it?, do i have to do something in code? or on JAS aministration console?

Please any help or hint will be apreciated...


Thanks!
Csar.
Sharad Agarwal
Ranch Hand

Joined: Sep 11, 2002
Posts: 167
Cesar - any application that maintains session on the servers will chew up resources even after the user has left (e.g., closed browser window). You can set the timeout for such sessions in your application server. Once you do that, these sessions don't hold onto resources forever.

Another thing to consider is the size of data in your sessions. Try to keep session objects small so that memory requirement for the same number of concurrent users is smaller.
[ May 27, 2005: Message edited by: Sharad Agarwal ]

Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
Cesar Tg.
Greenhorn

Joined: Jul 05, 2004
Posts: 16
Hi Sharad!

I wasn't refering to Sesions on data, In fact i am not using sessions, i meant it seems that TCP/IP connections are maintained by the JAS when the servlet doesn't find where to write the response(maybe user close the browser).. and because of this
the messages java.io.Exception broken pipe... are on logs

does it cause the Server CPU is always in 100%? (this open connections..)

and if so, what can i do to solve it?


Thanks
Csar
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

An application developer shouldn't really be too concerned with this.
It is really the duty of the people developing the container (tomcat or jas) to handle situations like this.

An end user breaking the connection by closing their browser going to another URL will cause this.

Does your sysadmin have any proof that the container isn't cleaning up after these broken connections or is s/he just disturbed by the log entries?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

i know the problem is due to servlet doesn't find
where to write the response, (maybe users hit on refresh, close the browser or something like this)


Another thought: Is it possible that these aren't connections broken by the user? Could they be timed out database connections that are still being maintained in your connection pool because the methods that use them aren't properly closing them?

That, is something that would cause a memory leak which can only be cleaned up by rebooting the app server.
[ May 27, 2005: Message edited by: Ben Souther ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.io.Exception , Broken pipe