You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Oscar <ro...@gmail.com> on 2009/11/22 05:59:07 UTC

Some threads blocked on java.net.SocketInputStream.socketRead0

hi all,

There was a wried thing happened  every other day in one of our
production environment, async-rpc was blocked on socketWrite0  and
never return.
Sally, we can't reproduce the wried thing.

Anybody met this bug before?(we use the TThreadPoolServer in the  server-side)

Today, I did another test. I found some threads of the server blocked
on soketRead0 this time.

1. run the tutorial java server using TThreadPoolServer mode.
2.  java client as follows:
		long start = System.currentTimeMillis();
		final int iteration = 500;
		for (int i = 0; i < iteration; ++i) {
			try {
				TSocket s = new TSocket("192.168.120.130", 9090);
				s.open();
			} catch (TException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		System.out.println((System.currentTimeMillis()-start)*1000/iteration);

3.  Run java server on the Linux box.
4. Run java client on Windows XP continuously.

Client process was finished, however, there were 94 established
connection in the server-side.
Jstack result was attached.

Any suggestions?


Thanks,
Oscar

Re: Some threads blocked on java.net.SocketInputStream.socketRead0

Posted by Bryan Duxbury <br...@rapleaf.com>.
Looks to me like you're not closing your client connections. If you  
don't close them, the server has to wait for timeouts to close  
connections. Add a s.close() call in there.

-Bryan

On Nov 21, 2009, at 8:59 PM, Oscar wrote:

> hi all,
>
> There was a wried thing happened  every other day in one of our
> production environment, async-rpc was blocked on socketWrite0  and
> never return.
> Sally, we can't reproduce the wried thing.
>
> Anybody met this bug before?(we use the TThreadPoolServer in the   
> server-side)
>
> Today, I did another test. I found some threads of the server blocked
> on soketRead0 this time.
>
> 1. run the tutorial java server using TThreadPoolServer mode.
> 2.  java client as follows:
> 		long start = System.currentTimeMillis();
> 		final int iteration = 500;
> 		for (int i = 0; i < iteration; ++i) {
> 			try {
> 				TSocket s = new TSocket("192.168.120.130", 9090);
> 				s.open();
> 			} catch (TException e) {
> 				// TODO Auto-generated catch block
> 				e.printStackTrace();
> 			}
> 		}
> 		System.out.println((System.currentTimeMillis()-start)*1000/ 
> iteration);
>
> 3.  Run java server on the Linux box.
> 4. Run java client on Windows XP continuously.
>
> Client process was finished, however, there were 94 established
> connection in the server-side.
> Jstack result was attached.
>
> Any suggestions?
>
>
> Thanks,
> Oscar