[jboss-jira] [JBoss JIRA] (WFLY-6912) Socket leak when client doesn't read the entire response

Sandeep Krishnan (JIRA) issues at jboss.org
Wed Aug 3 02:29:00 EDT 2016


     [ https://issues.jboss.org/browse/WFLY-6912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandeep Krishnan updated WFLY-6912:
-----------------------------------
    Steps to Reproduce: 
//read an attachment from server, terminate after reading 4k chars.

			InputStreamReader in = new InputStreamReader(con.getInputStream());
			char[] outputByte=new char[4096];
			while(in.read(outputByte, 0, 4096) != -1){
			   break;
		    }

Exception stacktrace
================
Caused by: java.io.IOException: Connection reset by peer
        at sun.nio.ch.FileDispatcherImpl.write0(Native Method) [rt.jar:1.8.0_45]
        at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) [rt.jar:1.8.0_45]
        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) [rt.jar:1.8.0_45]
        at sun.nio.ch.IOUtil.write(IOUtil.java:51) [rt.jar:1.8.0_45]
        at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) [rt.jar:1.8.0_45]
        at org.xnio.nio.NioSocketConduit.write(NioSocketConduit.java:152)
        at io.undertow.server.protocol.http.HttpResponseConduit.write(HttpResponseConduit.java:575)
        at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.write(AbstractFixedLengthStreamSinkConduit.java:106)
        at org.xnio.conduits.ConduitStreamSinkChannel.write(ConduitStreamSinkChannel.java:150)
        at io.undertow.channels.DetachableStreamSinkChannel.write(DetachableStreamSinkChannel.java:239)
        at io.undertow.server.HttpServerExchange$WriteDispatchChannel.write(HttpServerExchange.java:1850)
        at io.undertow.servlet.spec.ServletOutputStreamImpl.writeBufferBlocking(ServletOutputStreamImpl.java:567)
        at io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:220)


  was:
//read an attachment from server, terminate after reading 4k chars.

			InputStreamReader in = new InputStreamReader(con.getInputStream());
			char[] outputByte=new char[4096];
			while(in.read(outputByte, 0, 4096) != -1){
			   System.out.println("2");
			   break;
		    }

Exception stacktrace
================
Caused by: java.io.IOException: Connection reset by peer
        at sun.nio.ch.FileDispatcherImpl.write0(Native Method) [rt.jar:1.8.0_45]
        at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) [rt.jar:1.8.0_45]
        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) [rt.jar:1.8.0_45]
        at sun.nio.ch.IOUtil.write(IOUtil.java:51) [rt.jar:1.8.0_45]
        at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) [rt.jar:1.8.0_45]
        at org.xnio.nio.NioSocketConduit.write(NioSocketConduit.java:152)
        at io.undertow.server.protocol.http.HttpResponseConduit.write(HttpResponseConduit.java:575)
        at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.write(AbstractFixedLengthStreamSinkConduit.java:106)
        at org.xnio.conduits.ConduitStreamSinkChannel.write(ConduitStreamSinkChannel.java:150)
        at io.undertow.channels.DetachableStreamSinkChannel.write(DetachableStreamSinkChannel.java:239)
        at io.undertow.server.HttpServerExchange$WriteDispatchChannel.write(HttpServerExchange.java:1850)
        at io.undertow.servlet.spec.ServletOutputStreamImpl.writeBufferBlocking(ServletOutputStreamImpl.java:567)
        at io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:220)




> Socket leak when client doesn't read the entire response
> --------------------------------------------------------
>
>                 Key: WFLY-6912
>                 URL: https://issues.jboss.org/browse/WFLY-6912
>             Project: WildFly
>          Issue Type: Bug
>          Components: Web (Undertow)
>    Affects Versions: 8.2.0.Final
>         Environment: Cent OS 6.7/7.1
>            Reporter: Sandeep Krishnan
>            Assignee: Stuart Douglas
>              Labels: undertow, wildfly
>
> I'm facing an issue similar to UNDERTOW-427. If the client doesn't read the entire response sent by the server and terminates the connection before server does, then there is socket leak.
> Open files count
> =============
> [root at xyz apps]# lsof -p <jboss-pid> | wc -l
> 1331
> [root at xyz apps]# lsof | wc -l
> 12049
> After running around 1.5 k times.
> =========================
> [root at xyz apps]# lsof -p <jboss-pid> | grep "can't identify pro" | wc -l
> 1539
> [root at xyz apps]# lsof -p <jboss-pid> |  wc -l
> 2998
> [root at xyz apps]# lsof | wc -l
> 14831



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list