• Post Reply Bookmark Topic Watch Topic
  • New Topic

Broken pipe EXception

 
Sudhakar Reddy Kurakula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
It would be very kind of you to help me , how I could resolve this problem I
am facing now .

This is very urgent for me , so it would be really kind of anyone to let me
know how to resolve this problem.

The problem is i am running a Daemon which picks up about 4 ids' from the
database and then proceses the Http request.

I get this error exactly at the tihird time when the daemon picks up the
same ids. First and second time it works fine , but third time it Gives
java.io.BrokenPipe eXception..


The URL to which the connection is been established is a Servlet .
*************************
The code where the exception comes up is :

uc.setDoInput(true);
uc.setDoOutput(true);
uc.setUseCaches(false);
uc.setRequestProperty("Content-type",
"application/x-www-form-urlencoded");
uc.setRequestProperty("Content-length",""+data.length());

DataOutputStream dos=new DataOutputStream(uc.getOutputStream());
dos.writeBytes(data);
dos.flush();
dos.close();
In logDebug() ::After dos.writeBytes() Mon Oct 15 12:16:48 GMT+00:00 2001
java.io.IOException: Broken pipe
at java.net.SocketOutputStream.socketWrite(Native Method)
at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
at
weblogic.net.http.ContentLengthOutputStream.close(ContentLengthOutputStream.
java:56)
at java.io.FilterOutputStream.close(FilterOutputStream.java:143)
at com.netnames.rp.resutil.SendHttpPost.DataPost(SendHttpPost.java:73)
at
com.netnames.rp.resdaemon.ServerConnector.sendHttpRequest(ServerConnector.ja
va:209)
at
com.netnames.rp.resdaemon.ServerConnector.interactServer(ServerConnector.jav
a:145)
at
com.netnames.rp.resdaemon.RPResponseFromRegistryImpl.interpretStatus(RPRespo
nseFromRegistryImpl.java:284)
at
com.netnames.rp.resdaemon.RPResponseFromRegistryImpl.doPoll(RPResponseFromRe
gistryImpl.java:159)
at
com.netnames.rp.resdaemon.RPResponseFromRegistryImpl.run(RPResponseFromRegis
tryImpl.java:105)
at java.lang.Thread.run(Thread.java:475)
In logStaticInfo() ::Reusing RPSendToRegistryDB




could any body give answer why.

Cheers
Sudhakar
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Urgent, eh? It looke like "Lijoy John" had this exact problem over six years ago. It was "urgent" then too. I notice that you even phrase the problem the same way John did. That can't be coincidence, surely.

So, in the last six years, have you learned anything else about this problem? Does the exception occur rarely, often, or always when this code is run? Network connection exceptions can occur for reasons outside the programmer's control, after all. As a simple example, try disconnecting one end of your network cable while the program is running - you will probably see an error like this. So if this error is something that happens only rarely, you should probably just accept that it's outside your control, and try to instead catch the exception and recover gracefully from it. But if it's something that happens frequently, or always when this code is run, then there's probably a deeper problem. So, which is it?
 
Sudhakar Reddy Kurakula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see I want to solve this type of problems in development.
I am asking to know the reason.But no body is giving proper answer.
Remembe everything is done by human being .So certainly there will be solutin to that problem.Dont say it is network problem and it is not under the control of programmer like that.

If any knows sol ,please give me.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry if you don't consider this a "proper answer". But in six years, have you not yet mastered the try/catch block? Look, if the network goes down (and yes that IS outside your control, whether you like it or not) then you need to deal with that situation intelligently. That means you need to catch the IO exception and recover from it somehow. The simplest solution is to give up and report an error. The next-simplest solution is to keep retrying until you succeed. After that, try a progressive solution where you retry several times, maybe at increasing intervals, then eventually give up if no network connection can be obtained.

If you want another answer, could you at least answer the really basic question I posed? Does this problem occur always, often, or rarely? You've had six years to study it, give us some info please.
[ December 31, 2006: Message edited by: Jim Yingst ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!