2 Replies Latest reply on Nov 9, 2005 5:42 PM by Darran Lofthouse

    OutOfMemoryError

    Rita Sodini Newbie

      We have a problem with the execution of a STRESS test with our EJB application in JBOSS.
      Our application is an implementation of MessageDrivenBean, that listens on a queue for messages arriving. When we start our STRESS test, several messages are sent from our Testing-Tool to the application through this queue. The problem is that although test-messages are sent serially, so that only the at the first arrival the EJB is created, the memory allocation grows up at any arrival.
      When the first STRESS test ends, we start a new one, identical to the first, an OutOfMemoryError occurs; in the log file we can read the following lines:

      2005-10-20 11:36:44,171 WARN [org.jboss.mq.il.uil2.UILServerILService] Unexpected error in setup of client connection
      java.lang.OutOfMemoryError: unable to create new native thread
      at java.lang.Thread.start0(Native Method)
      at java.lang.Thread.start(Thread.java:574)
      at org.jboss.mq.il.uil2.SocketManager.start(SocketManager.java:132)
      at org.jboss.mq.il.uil2.UILServerILService.run(UILServerILService.java:134)
      at java.lang.Thread.run(Thread.java:595)
      2005-10-20 11:36:44,171 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectInputStream
      2005-10-20 11:36:44,187 DEBUG [org.jboss.mq.il.uil2.SocketManager] Exiting on unexpected error in read task
      java.lang.OutOfMemoryError: unable to create new native thread
      at java.lang.Thread.start0(Native Method)
      at java.lang.Thread.start(Thread.java:574)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.addThread(PooledExecutor.java:520)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.execute(PooledExecutor.java:880)
      at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:302)
      at java.lang.Thread.run(Thread.java:595)
      2005-10-20 11:36:44,187 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Exiting on unexpected error in read task
      java.lang.OutOfMemoryError: unable to create new native thread
      at java.lang.Thread.start0(Native Method)
      at java.lang.Thread.start(Thread.java:574)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.addThread(PooledExecutor.java:520)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.execute(PooledExecutor.java:880)
      at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:302)
      at java.lang.Thread.run(Thread.java:595)
      2005-10-20 11:36:44,187 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run
      2005-10-20 11:36:44,187 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run
      2005-10-20 11:36:44,187 INFO [STDOUT] org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwable: (java.io.EOFException)

      Anyone knows what's the problem? We are new JBOSS users and EJB developers, and unfortunately we don't know how to resolve this (serious) problem.
      Thanks a lot.

        • 1. Re: OutOfMemoryError
          Oliver Hernandez Newbie

          I believe this is due to how your JVM is configured to run. I am currently troubleshooting the same issue we're seeing periodically with our production JBoss 3.2.2 server.

          Apparently, Java allocates memory in the OS not only for the object heap (specified by the -Xms & -Xmx options), but also for native threads. Each native thread allocates what's called stack memory, and that is controlled by the -Xss option. If a Java app creates thousands of threads, and the thread stack size is set too high, then the app can run out of memory. On the other hand, if the heap size is set too high, and the GC doesn't run aggressively enough, the Java app may run out of memory as it requests memory for new native threads.

          A solution we're going to attempt is decreasing the maximum heap size. We're running JBoss on a Windows 2000 Server, and set the JVM to run with a max heap size of 1536 MB. 2 GB is the maximum amount of memory Windows can allocate to a single process, and maybe setting our max heap size to 1.5 GB doesn't leave enough room for native thread stacks.

          • 2. Re: OutOfMemoryError
            Darran Lofthouse Master

            This discussion has absolutely nothing to do with Javassist.