hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Halo chen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HTTPCORE-118) Some strange issue under a heavy stress test
Date Sat, 29 Sep 2007 02:50:51 GMT

     [ https://issues.apache.org/jira/browse/HTTPCORE-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Halo chen updated HTTPCORE-118:
-------------------------------

    Attachment: SendToIA.java

the test case

> Some strange issue under a heavy  stress test
> ---------------------------------------------
>
>                 Key: HTTPCORE-118
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-118
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: Examples, HttpCore, HttpCore NIO
>    Affects Versions: 4.0-alpha5
>         Environment: Windows xp(sp2), JDK 1.5
>            Reporter: Halo chen
>            Priority: Critical
>             Fix For: 4.0-alpha5
>
>         Attachments: a.txt, SendToIA.java
>
>
> Thanks very much for your contributions.
> I use your httpcore to develop a embed web application, very well, I think. 
> But, when i do some stress test, i find a strange issue, please see my test case:
> public class SendToIA implements Runnable {
> 	String[] args;
> 	SendToIA( String[] args )
> 	{
> 		this.args = args;
> 	}
> 	public void run()
> 	{
> 		try {
> 			FileInputStream fis = new FileInputStream("a.txt");
> 			int len = fis.available();
> 			byte[] buf = new byte[len];
> 			fis.read(buf);
> 			fis.close();
> 			String ReuestHead = "POST /TerminalLocationNotification HTTP/1.1\r\nHOST: LOCALHOST\r\nContent-Length:
";
> 			String ReuestLen = String.valueOf(len) + "\r\n\r\n";
> 			String RequestBody = new String(buf);
> 			String httpRequest = ReuestHead + ReuestLen + RequestBody;			
> 			String host = "localhost";
> 			int port = 8086;
> 			if( args.length == 1 )
> 			{
> 				host = args[0];
> 			}
> 			else if( args.length == 2 )
> 			{
> 				host = args[0];
> 				port = Integer.parseInt( args[ 1 ] );
> 			}
> 			
> 			System.out.println(new java.util.Date());
> 			for (int i = 0; i < 20000; i++) {
> 				Socket connection = new Socket( host, port );
> 				connection.setReuseAddress( true );
> 				PrintWriter out = new PrintWriter(connection.getOutputStream(), true);
> 				out.print(httpRequest);
> 				out.flush();
> 				connection.close();		
> 				System.out.print("\b\rcont:"+i);
> 			}
> 			System.out.println(new java.util.Date());
> 		} catch (SecurityException e) {
> 			e.printStackTrace();
> 		} catch (Exception e) {
> 			e.printStackTrace();
> 		}
> 	}
> 	public static void main(String[] args) throws IOException {
> 		int threadcount = 1;
> 		if( args.length == 3 )
> 		{
> 			threadcount = Integer.parseInt( args[ 2 ] );
> 		}
> 		Thread[] t = new Thread[ threadcount ];
> 		for( int i = 0 ; i < threadcount ; i ++ )
> 		{
> 			new Thread( new SendToIA( args )	).start();
> 		}
> 		for( int i = 0 ; i < threadcount ; i ++ )
> 		{
> 			try{t[i].join();}catch( Exception e ){}
> 		}
> 	}
> }
> Unfortunately, the application was crashed. 
> The first , I think my application has some mistake. so I run the example( org.apache.http.examples.nio.NHttpServer)
in the HttpCore binary package. Oh,No!
> The same issue was occured! 
> Why? I found the memory usage of the application reach 170M!!, and then I add the JVM
parameter -Xmx256M.Okay, the application can running continue. but after a long time, the
memory usage of the application reach 256M and then the same thing was occured! So , I think
that the HttpCore has some memory leak.
> Can you give me some advices to resolve this issue? or I have some mistakes?
> details of error occured:
> ...
> Exception in thread "I/O reactor worker thread 2" java.lang.OutOfMemoryError: Java heap
space
> ....
> java.lang.NullPointerException
> 	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.verifyWorkers(AbstractMultiworkerIOReactor.java:136)
> 	at org.apache.http.impl.nio.reactor.DefaultListeningIOReactor.execute(DefaultListeningIOReactor.java:111)
> ....
> Exception in thread "I/O reactor worker thread 8" java.lang.OutOfMemoryError: Java heap
space
> Exception in thread "Thread-6" java.lang.OutOfMemoryError: Java heap space
> Sorry , I'm chinese , my english is bad, may be i haven't explain the issue clearly.
but I need your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message