Saturday, December 26, 2009

IOException: Broken pipe

java.io.IOException: Broken pipe

In Client server application, Message send from/to. If message size is less than 10MB, then we would have not faced any issues. Since most of the application/web server comes with default configuration for message size to 10MB or more.

Usecase : upload a zip file from client to server

In server side, any of the endpoints like Servlet(http), EJB, JMS, or TCP, has to be established to receive message as byte array or byte array holding java objects. Stream objects can not be serialized, it has to be stored as byte and trasmitted. While marshalling and unmarshalling byte array object, Heap usage go to the peak. In this time, we may get OutOfMemoryException

In Client Side, InputStream created to read data from file and convert into byte array.

If server receives message more than the size configured then server will throw weblogic.socket.MaxMessageSizeExceededException

<ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'> <<WLS Kernel>> <> <> <1229479358244> 
<BEA-000403> <IOException occurred on socket: Socket[addr=/127.1.1.34,port=281 30,localport=8001] 
weblogic.socket.MaxMessageSizeExceededException: Incoming message of size: '10000080' bytes 
exceeds the configured maximumof: '10000000' bytes for protocol: 't3'.>
at weblogic.socket.BaseAbstractMuxableSocket.incrementBufferOffset(BaseAbstractMuxableSocket.java:174)
at weblogic.rjvm.t3.MuxableSocketT3.incrementBufferOffset(MuxableSocketT3.java:343)
at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:906)
at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:842)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:335)
at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)

If server receives message even with in the limit, but while unmarshalling data, application exceeds heap size, then server will drop the connection established with client abrubtly with OutOfMemoryException. Since connection got closed then we do get IOException as below.

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)


Note:Broken pipe message comes for anytime stream could not able to write/read data from file(socket). In general, heart beat will be delivered by server/client in stipulated format. If this max number of attempts cross then application assumes that socket is closed by other party and throws this exception.


Weblogic

In weblogic server console or config xml, we can set maximum message size only to the http protocol or t3 or all the protocols.

Environment > servers > soa_server > protocols > General > change Maximum Message Size as below

<max-message-size>100000000</max-message-size>
<max-t3-message-size>100000000</max-t3-message-size>
<max-http-message-size>100000000</max-http-message-size>
The above code set 100mb for these properties. These configuration helps to intimate the server that maximum message of receiving capacity. There is no configuration required to be configured to send message from server.

What about client side, to receive 100 mb message?

Yes, we have to set weblogic.MaxMessageSize config property in commandline.

-Dweblogic.MaxMessageSize=100000000


Refer this link supported maximum message size in weblogic

Reactions:

0 comments:

Post a Comment

Recent Posts

Unix Commands | List all My Posts

Texts

This blog intended to share the knowledge and contribute to JAVA Community such a way that by providing samples and pointing right documents/webpages. We try to give our knowledege level best and no guarantee can be claimed on truth. Copyright and Terms of Policy refer blogspot.com

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More