Reply
Fanfare
rbaswareddy
Posts: 13
Registered: 12-11-2009
0

java.lang.OutOfMemoryError: unable to create new native thread

Hi Team,

One of our customer has encountered an issue while he is running a test case having spirent test center and telnet that
is developed in 3.3 and throwing error while they are running the same after  upgrading to 3.4.


While executing testcase following error occured

       "java.lang.OutOfMemoryError: unable to create new native thread
        and testcase could not be executed any more."


According to Customer, this didn't occur in 3.3 but he encountered this after upgrading to 3.4.

Any idea around this?

 

 

Thanks in advance.

 

Community Leader
PaulD
Posts: 1,214
Registered: 09-02-2008
0

Re: java.lang.OutOfMemoryError: unable to create new native thread

I suspect that they were right on the edge in 3.3 and got nudged over the top of memory needs in 3.4.  There are several postings around explaining how to increase the available memory for iTest.  But one should also be asking whether there is anything about the test cases involved that would be pushing the need for this much memory.  In most cases I've seen it is only unusual situations that require this much memory -- like running many many test cases concurrently all doing aggressive analysis.  Before increasing memory, it may be worth reviewing what might be driving this need for memory.

Expert
KumarS
Posts: 2,233
Registered: 08-30-2008
0

Re: java.lang.OutOfMemoryError: unable to create new native thread

iTest ships with heap size set to 384M in iTest.ini file. That is just a guess for what user will need. User can go ahead and add a single step of "readFile" on a 1 Gig file and iTest will get out of memory error. This does not mean that iTest has a memory problem - it implies that the user has to be aware of the memory requirements of the testcases he/she is writing. Generally, in most cases, people should not and do not worry about because 384M is good enough for most people. But when you start getting out of memory errors, it is time to check memory requirements of testcases. Generally increased memory usage comes from a few factors:

1. user is trying to parse huge amounts of data (a large table being response mapped or a large textual response is being stored and processed). I have seen people process responses as big as 50 Mbyte with iTest set to just 384M of heap and getting frustrated with out of memory exceptions.

2. user is create a large number of threads which process significant amounts of data but not as large as #1. But total amount happens to be in excess of hundreds of mega bytes.

3. Sometimes, out of memory happens over time. iTest will cache certain amounts of data to improve performance. But over days, if one starts reaching the limit of heap size due to caching, one can get out of memory exceptions. Only solution in this case is to increase the heap size.

 

My first recommendation to people is:

1. memory is too cheap, human analysis time is too expensive - add memory to the system and set iTest heap size to 1 Gig or 2 Gigs and do not spend time analyzing how much memory I need.

2. If  #1 is not an option, then turn on iTest's preference to show heap status and single step through your testcase and see which step's execution causes a spike in memory usage. See if you can reduce the size of response to be analyzed by iTest (using response filters) or not mapping the huge response.

 

 

Fanfare
IvanS
Posts: 74
Registered: 07-22-2009
0

Re: java.lang.OutOfMemoryError: unable to create new native thread

The message "java.lang.OutOfMemoryError: unable to create new native thread" means that the system process has no more memory available to create a new OS-thread within this process.
If you are running on Linux check for values of the soft and hard limits (kernel settings) on the number of threads allowed per process on your system. These limits may have been set to a low value on your system.

Contributor
Yas
Posts: 92
Registered: 09-10-2008
0

Re: java.lang.OutOfMemoryError: unable to create new native thread

Running Win2K3 Server configured over 1GB JVM setting (both of -Xms and -Xmx) with 4GB memory.

The test senario could be executed in 3.2(NOT 3.3) but encountered this issue after upgarding to 3.4. 

 

 

Contributor
Yas
Posts: 92
Registered: 09-10-2008
0

Re: java.lang.OutOfMemoryError: unable to create new native thread

I have two questions.

 

1. Are there any better way to find which step cunsuming a huge memory rather than maually clicking "execute next step" on the console and watching heap size during execution ? 

 

2. Are thre any memory or thread limitation in Windows or Windows 2K3 Server ?

 

Thank you

 

Contributor
Yas
Posts: 92
Registered: 09-10-2008
0

Re: java.lang.OutOfMemoryError: unable to create new native thread

Let me ask one more

 

Are there any way to manually execute garbage collection ?

 

I don't think it is a good way to execute garbage collectionso frequently by manual operation, however, let's say there is a testsuite with 100 calling steps. If executing garbage collection manually when each calling step finishes helps memory consumption, I would like to try garbage collection manually.

 

Thank you

Community Leader
PaulD
Posts: 1,214
Registered: 09-02-2008
0

Re: java.lang.OutOfMemoryError: unable to create new native thread

Manually performing garbage collection will have no effect on whether you can run anything bigger.  The garbage collector will run automatically when it needs to have access to additional memory.

 

Having said that, if you are interested in just understanding memory use, you can, indeed, force a garbage collection.  Start by checking "Show heap status" in Windows > Preferences > General.  Once done, in the status bar of the main window, on the right side, you'll now see information about current memory use.  If you click on the icon (garbage can) there, it will force an immediate garbage collection.

Expert
KumarS
Posts: 2,233
Registered: 08-30-2008
0

Re: java.lang.OutOfMemoryError: unable to create new native thread

If you search the forums, you can find the thread where Doug Claar has posted a solution to find the largest "step" size in your reports table. You can use that information to track which testcase is the culprit for storing/processing huge responses.

Contributor
Yas
Posts: 92
Registered: 09-10-2008
0

Re: java.lang.OutOfMemoryError: unable to create new native thread

Thanks all,

 

Understood that manual garbage colletion is not a good solution and doesn't help.

 

I am going to try to find big steps or long duration step using samething like this SQL

SELECT REPORTID, EXECUTEDSTEPID, SESSION, ACTION, DURATION, LENGTH(DETAILS)  FROM REPORTITEM WHERE REPORTID = XXXXX

 

After googling about performance tuning, jstat or jconsole may help to find a memory spike....