You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by "pawel.ruta" <pa...@asseco.pl> on 2013/03/26 11:46:02 UTC
OpenEJB Http - Connection reset (4.5.0, 4.5.1)
Randomly I'm getting "java.net.SocketException: Connection reset" exception
when using OpenEJB embedable as a server for Statless Web Services (CXF
implementation) and CXF WS client. On some computers it never happens, on
some almost always, on some randomly. It happens (randomly) when SOAP
Message generated by a server is more than 8192 bytes in size (related to
buffer size in SocketInputStream.java).
I've noticed that in OpenEJBHttpServer.java
(org.apache.openejb.server.httpd.OpenEJBHttpServer), method service(Socket
socket) you are closing OutputStream immediatelly after flushing data.
Closing OutputStream means also closing socket. Closing socket means
"Connection reset" if client isn't fast enough to recieving data from
socket. Client-server communication using ServerSocket and Socket is a bit
tricky. In ideal situation client should report that it is ending the
comunication and then server shoudl close socket. That's not a case for
HttpServer. I propose the solution to wait for client to close socket (all
good implementation of client will close socket :) ). We can wait
(non-blocking) for client closing socket by reading InputStream. When client
close connection then InputStream returns -1. If c OpenEJBHttpServer.java
<http://openejb.979440.n4.nabble.com/file/n4661789/OpenEJBHttpServer.java>
lient doesn't responde connection timeout occur (default is 60 seconds I
suppose).
I've attached changed sources. The solution is quick (dirty). Probably the
more sophisticated approach for managing resource (threads, sockets) should
be used.
Reported exception, full stack:
javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: Connection reset
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
Caused by: javax.xml.bind.UnmarshalException
with linked exception:
[com.ctc.wstx.exc.WstxIOException: Connection reset]
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:426)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:784)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:97)
at org.apache.cxf.jaxb.JAXBEncoderDecoder$1.run(JAXBEncoderDecoder.java:812)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:810)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:644)
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:157)
at
org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1694)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1530)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1438)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:660)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 36 more
Caused by: com.ctc.wstx.exc.WstxIOException: Connection reset
at com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:631)
at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:999)
at com.ctc.wstx.sr.StreamScanner.getNext(StreamScanner.java:759)
at
com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2662)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1048)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:192)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
... 60 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.MeteredStream.read(MeteredStream.java:116)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2672)
at com.ctc.wstx.io.BaseReader.readBytes(BaseReader.java:155)
at com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:368)
at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:111)
at com.ctc.wstx.io.MergedReader.read(MergedReader.java:105)
at com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:87)
at
com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:993)
... 65 more
--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-Http-Connection-reset-4-5-0-4-5-1-tp4661789.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.
Re: OpenEJB Http - Connection reset (4.5.0, 4.5.1)
Posted by Romain Manni-Bucau <rm...@gmail.com>.
hi
answered
if you can give it a try building the snapshot ;)
*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*
2013/3/26 pawel.ruta <pa...@asseco.pl>
> I've found JIRA project for issue tracking. Sorry for reporting it here.
>
> If someone is interested:
> https://issues.apache.org/jira/browse/OPENEJB-2010
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-Http-Connection-reset-4-5-0-4-5-1-tp4661789p4661796.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>
Re: OpenEJB Http - Connection reset (4.5.0, 4.5.1)
Posted by "pawel.ruta" <pa...@asseco.pl>.
I've found JIRA project for issue tracking. Sorry for reporting it here.
If someone is interested: https://issues.apache.org/jira/browse/OPENEJB-2010
--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-Http-Connection-reset-4-5-0-4-5-1-tp4661789p4661796.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.