2

Does any1 have any idea what could be the cause of these java errors?

The java version should be 1.4.1_05. This is related to PeopleSoft.

"VM Thread" prio=5 tid=0x00B8EF28 nid=0x5f8 runnable 
"VM Periodic Task Thread" prio=10 tid=0x00CF4CF8 nid=0x648 waiting on condition 
"Suspend Checker Thread" prio=10 tid=0x00CF5760 nid=0x64c runnable 
<Nov 17, 2011 1:41:46 PM GMT+08:00> <Error> <HTTP> <BEA-101017> <[ServletContext(id=21840659,name=PORTAL,context-path=)] Root cause of ServletException.
java.lang.OutOfMemoryError: unable to create new native thread
                at java.lang.Thread.start(Native Method)
                at bea.jolt.NwHdlr.start_threads(NwHdlr.java:1982)
                at bea.jolt.NwHdlr.openConnection(NwHdlr.java:879)
                at bea.jolt.CMgr.connect(CMgr.java:71)
                at bea.jolt.JoltSession.logon(JoltSession.java:246)
                at bea.jolt.JoltSession.<init>(JoltSession.java:125)
                at psft.pt8.net.JoltSessionWrapper.<init>(JoltSessionWrapper.java:67)
                at psft.pt8.net.JoltSessionPool.createConnection(JoltSessionPool.java:373)
                at psft.pt8.net.JoltSessionPool.getJoltSession(JoltSessionPool.java:220)
                at psft.pt8.net.NetSession.getJoltSession(NetSession.java:484)
                at psft.pt8.net.NetReqRepSvc.sendRequest(NetReqRepSvc.java:526)
                at psft.pt8.net.NetService.requestService(NetService.java:141)
                at psft.pt8.net.NetReqRepSvc.requestService(NetReqRepSvc.java:328)
                at psft.pt8.net.NetSession.connect(NetSession.java:269)
                at psft.pt8.net.NetSession.<init>(NetSession.java:203)
                at psft.pt8.jb.JBEntry.connectWithBlob(JBEntry.java:720)
                at psft.pt8.jb.JBEntry.connect(JBEntry.java:654)
                at psft.pt8.auth.PSAuthenticator.authenticate(PSAuthenticator.java:546)
                at psft.pt8.psreports.onLogin(psreports.java:216)
                at psft.pt8.psreports.onAction(psreports.java:321)
                at psft.pt8.psreports.service(psreports.java:181)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
                at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
                at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
                at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
                at psft.pt8.psfilter.doFilter(psfilter.java:71)
                at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
                at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6372)
                at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
                at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
                at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3643)
                at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
                at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
                at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>
COD3BOY
  • 11,964
  • 1
  • 38
  • 56
  • How many threads have you got running, and how much memory are you already using? – Jon Skeet Nov 17 '11 at 08:23
  • the stacktrace says that quite well - 'OutOfMemoryError' – stratwine Nov 17 '11 at 08:25
  • How many threads are running when this happens? According to this thread http://stackoverflow.com/questions/481900/whats-the-maximum-number-of-threads-in-windows-server-2003 , the limitation is the existance of contiguous memory blocks for the stack. – Klas Lindbäck Nov 17 '11 at 08:27

6 Answers6

2

You're creating too many threads for the memory available for thread stacks. You can reduce the number of threads you create, or decrease their default stack size from the (generous) default. -XX:ThreadStackSize=128 would make it 128KB. Of course, too little stack and you may hit StackOverflowError (heh) if you have a particularly deep method call.

Since you have to make a lot of threads (thousands) to hit this with a default stack size, my gut says your best solution is #1. You don't need thousands of threads in your app.

Sean Owen
  • 66,182
  • 23
  • 141
  • 173
1

The immediate cause is that your JVM has run out of memory to create stacks for new threads.

The root cause is harder to determine:

  • The application could be creating threads unnecessarily or wastefully.

  • The application could be leaking threads on a redeployment.

  • Threads could be blocking in I/O (e.g. reading a socket) and never coming back.

  • There could be bugs in a custom thread pool that causes threads to be lost.

  • The memory that you need for new stacks could have been used up by other things; e.g. by the heap or in memory mapped files or non-heap allocation by JNI code.

  • And so on ...

Tweaking the thread stack size is a bandaid solution that might work in the short term. But in the long term you need to find out what is actually causing the problem.

You should could start by configuring the JVM to create an dump file on OOME, and use the post mortem dump analyser to see if there are any clues; e.g. lots of threads in unexpected states.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

import java.util.Scanner;

/**
 *
 * @author smart
 */
public class JavaApplication1 {


    public static void main(String[] args) {

        String cname;
        double quantity, price, dp, total, dv, finaltotal;

        Scanner S=new Scanner(System.in); 


        System.out.println("please enter clientname");

        cname=S . nextLine();
        System.out.println("please enter quantity");
        quantity=S . nextDouble();
        System.out.println("please enter price");
        price=S . nextDouble();
        System.out.println("please enter discount percentage");
        dp=S . nextDouble();

        total=S . nextDouble();
        dv=S . nextDouble();
        finaltotal=S . nextDouble();

        total= quantity+price;
        dv= price-dp;
        finaltotal=total*dv;

        System.out.println(total);

        System.out.println(dv);

        System.out.println(finaltotal);           
    }   
}
Nicola Ben
  • 10,615
  • 8
  • 41
  • 65
Moka
  • 1
0

This error message usually means your system has run out of a resource required to start a thread. Usually this is memory for the stack.

Java 1.4.1 was released in Sep 2002. Perhaps your system needs upgrading (possibly the hardware used or software versions)

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • I agree that the JVM should be updated, but that is unlikely to solve the immediate problem. (Also, that message means it is *definitely* the stack memory.) – Stephen C Nov 17 '11 at 08:39
0

java.lang.OutOfMemoryError can be caused due to available memory to your application or it can be also caused due to memory leaks in your application. Check related thread link

JVM allocates each thread memory space called thread stack. Default value depends on what OS and JVM. You can try allocating memory allocated to thread by setting -Xss option and also try reducing space allocated to heap memory -Xmx option. Check this article for JVM Tuning link.

Community
  • 1
  • 1
questborn
  • 2,735
  • 2
  • 16
  • 17
0

Well, it says

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

so it seems that you don't have enough memory. It might be that old threads don't get killed off, so there come more and more and more untill memory is full?

Alternatively, you could increase the memory size of Java.

Willem Mulder
  • 12,974
  • 3
  • 37
  • 62