Thread stack size problem

Hi all,
I am having a multithreaded application and the threads are created with 256 KB thread stack size.
This application was developed in windows(32 bit) now ported to Solaris 8.
The same was failed while running because of stack overflow and then the thread stack size is increased to 257 KB then the application is working fine.
Please anybody suggest me how the same application is working fine in windows with lesser thread stack size?
Please also suggest me any tool which can be used to get the thread stack details while running the application.
Regards,
Velan.R.S

Hello Farhan
We had similar issues and we tackled it in a few ways. First you may want to track down what type of memory issues you are hitting, permgen verse heap
Simple Tomcat updates I would look into
set your inital memory pool to something like 256 MB
Up your max to 2 or 3 GB
if you are having permgen issues i would set the following in your tomcat java options
-Xrs
-XX:MaxPermSize=512M
-XX:+CMSClassUnloadingEnabled
-XX:+UseConcMarkSweepGC
-XX:+CMSPermGenSweepingEnabled
-Djava.awt.headless=true
I would also look into increasing your treads and adding compression to your 8080 listener
Tomcat Vertical Scale
Once you have done the simple tomcat updates if you still have issues you may want to add more tomcat instances and use use a proxy server to load balance them. You can use Apache with mod_proxy or mod_jk. or even a more enterprise solution with an appliance like BigIP f5 or Cisco CSS.
I would really recommend front your tomcat(s) with Apache and doing a split deploy. Then fronting your apache servers with an appliance load balancer. James Rapp has a great article on how to do this. 

Similar Messages

  • Optimizing thread stack size

    There seems to be general confusion around the actual behaviour of the -Xss option.
    I need to optimise the thread stack size on Windows 2000 server running JVM 1.4.2 (07).
    1. What is the actual minimum stack size for this JVM ? 1k, 6k, 64k ?
    2. Do there exist any mechanism to measure the maximum value actually utilized by a particular application ?
    The goal is simply to allocate the appropriate amount of stack space instead of guessing a safe value.

    The default stack size is 256K on UNIX and on 32-bit Windows operating systems. To set Stack size
    java -XX:NewSize=128m -XX:MaxNewSize=128m -XX:SurvivorRatio=8 -Xms512m -Xmx512m
    1. Setting the New generation heap size
    -XX:NewSize
    Use this option to set the New generation Java heap size. Set this value to a multiple of 1024 that is greater than 1MB. As a general rule, set -XX:NewSize to be one-fourth the size of the maximum heap size. Increase the value of this option for larger numbers of short-lived objects.
    Be sure to increase the New generation as you increase the number of processors. Memory allocation can be parallel, but garbage collection is not parallel.
    2. Setting the maximum New generation heap size
    -XX:MaxNewSize
    Use this option to set the maximum New generation Java heap size. Set this value to a multiple of 1024 that is greater than 1MB.
    3. Setting New heap size ratios
    -XX:SurvivorRatio
    The New generation area is divided into three sub-areas: Eden, and two survivor spaces that are equal in size.
    Use the -XX:SurvivorRatio=X option to configure the ratio of the Eden/survivor space size. Try setting this value to 8, and then monitor your garbage collection.
    4. Setting minimum heap size
    -Xms
    Use this option to set the minimum size of the memory allocation pool. Set this value to a multiple of 1024 that is greater than 1MB. As a general rule, set minimum heap size (-Xms) equal to the maximum heap size (-Xmx) to minimize garbage collections.
    5. Setting maximum heap size
    -Xmx
    Use this option to set the maximum Java heap size. Set this value to a multiple of 1024 that is greater than 1MB.
    Hope these are the options you are looking for.

  • Stack size for native thread attaching to JVM

    All:
    I have a native thread (see below, FailoverCallbackThread) that attaches to the JVM and does a Java call through JNI. The stack size for the native thread is 256KB.
    at psiUserStackBangNow+112()@0x20000000007a96d0
    at psiGuessUserStackBounds+320()@0x20000000007a8940
    at psiGuessStackBounds+48()@0x20000000007a8f60
    at psiGetPlatformStackInfo+336()@0x20000000007a9110
    at psiGetStackInfo+160()@0x20000000007a8b40
    at psSetupStackInfo+48()@0x20000000007a5e00
    at vmtiAttachToVMThread+208()@0x20000000007c88b0
    at tsAttachCurrentThread+896()@0x20000000007ca500
    at attachThread+304()@0x2000000000751940
    at genericACFConnectionCallback+400(JdbcOdbc.c:4624)@0x104b1bc10
    at FailoverCallbackThread+512(vocctx.cpp:688)@0x104b8ddc0
    at start_thread+352()@0x20000000001457f0
    at __clone2+208()@0x200000000030b9f0
    This causes stack overflow in Oracle JRockit JVM. (It does not cause overflow with Oracle Sun JDK.) Is there a recommended stack size for this use case for JRockit? Is there a way to compute it roughly?
    Platform Itanium 64 (linux)]
    java version "1.5.0_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
    BEA JRockit(R) (build R26.4.0-63-63688-1.5.0_06-20060626-2259-linux-ia64, )
    mp

    How do I found default heap size, stack size for the
    thread, number of threads per jvm/process supported ?The threads is OS, OS install and jvm version specific. That information is also not useful. If you create the maximum number of threads that your application can create you will run out of memory. Threads require memory. And it is unlikely to run very well either.
    The default heap size and stack size are documented in the javadocs that explain the tools that come with the sun jdk.
    and how the above things will vary for each OS and how
    do I found ? Threads vary by OS, and OS install. The others do not (at least not with the sun jvm.)
    If I get "OutOfMemoryError: Unable to create new native thread" Most of the time it indicates a design problem in your code. At the very lease, you should consider using a thread pool instead.
    I found in one forum, in linux you can create maximum
    of 894 threads. Is it true ?Seems high since in linux each thread is a new process, but it could be.

  • Is there a solution to Rapidweaver Stacks Cache size problems?

    Is there a solution to Rapidweaver Stacks Cache size problems?
    My website http://www.optiekvanderlinden.be , has about 100 pages and is about 250MB in size. Every time I open RapidWeaver with the Stacks-plugin, the user/library/cache/com.yourhead.YHStacksKit folder grows to several Gigabytes in size. If I don't  manually empty the com.yourhead.YHStacksKit Cache daily, AND empty the Trash before i turn off my mac, my Mac still has problems and stalls at startup the next day. Sometimes up to 5 minutes and more before he really boots. If i have a been working on such a large site for a few weeks without deleting that cache, than my iMac doesn't start up anymore, and the only thing left to do is completely reinstall the iOs operating system. This problem doesn't happen the days i use all my other programs but don't use Rapidweaver.
    Does anyone know a solution and / or what is the cause of this?

    once more,
    i just launched my project in Rapidweaver, and WITHOUT making any changes to my pages, the cache/com.yourhead.YHStacksKit folder filled itself with 132 folders (total 84Mb), most of them containing images of specific pages etc. The largest folder in the cache is the one with the images of a page containing a catalogue of my company, this folder is 7Mb. It seems by just starting up a project, immediately different folders are created containing most of the images in my project, and some folders with a log.txt file. Still i don't see the reason why it is filling op a huge Cache even without making changes to the project. I have 2 different sites, so 2 different projects, and i get this with both of them.

  • RangeError: Maximum call stack size exceeded

    Dear all,
    we are executing and EDGE project in a Samsung SmartTV.  In more powerful models (more memory and cpu) the execution is correct. but in some old TV models we receive the following  message:
    File:   file://c/........../EDGE_006/edge_includes/edge.2.0.1.min.js
    Line No:  135
    Error Detail: RangeError: Maximum call stack size exceeded.
    It seems that this happens depending on the complexity of the EDGE project, as for some simple projects it works.
    we would like to adjust our EDGE project for this less powerful models modifiying animations and simplifying complexity, but we dont know where to start (which animations to remove, etc.)
    Or if there are some parameters in the edge API to adjust in order to increase performance in low memory browsers.
    Thank you in advance,
    Luis

    sunil-online wrote:
    > I am calling an external DLL and running it in the UI thread. How much
    > stack space is available when they are on separate threads or on the
    > UI thread?
    >
    > The problem is that I am getting seemingly random crashes while
    > running this VI and after I quit labview after stopping and uninit-ing
    > my DLL.
    Unless you know this DLL is using exceedingly lots of stack (at least
    several dozens of MB) for whatever obscure reasons it is very unlikely
    that running out of stack space is causing your problem. More likely
    either the DLL does something nasty to a data pointer passed in to it or
    you made an error in setting up the call to the DLL.
    For instace if the DLL expects strings or array pointers to be passed in
    they need to
    be allocated by the caller (here LabVIEW) and you need to
    tell LabVIEW to do that in the diagram code.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Call Stack Size

    Is there a way to increase the call stack size of LabVIEW or to know
    when it has been exceeded?
    Thanks.

    sunil-online wrote:
    > I am calling an external DLL and running it in the UI thread. How much
    > stack space is available when they are on separate threads or on the
    > UI thread?
    >
    > The problem is that I am getting seemingly random crashes while
    > running this VI and after I quit labview after stopping and uninit-ing
    > my DLL.
    Unless you know this DLL is using exceedingly lots of stack (at least
    several dozens of MB) for whatever obscure reasons it is very unlikely
    that running out of stack space is causing your problem. More likely
    either the DLL does something nasty to a data pointer passed in to it or
    you made an error in setting up the call to the DLL.
    For instace if the DLL expects strings or array pointers to be passed in
    they need to
    be allocated by the caller (here LabVIEW) and you need to
    tell LabVIEW to do that in the diagram code.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Error stack size

    Hi,
    i have build a package framework which in exceptional situations uses an encapsulated raise_application_error method with the
    -add to error stack- option. In combination with
    -speaking- messages it seems as if i am now running against the error stack size border. What i see is that the primarily generated errors are lost.
    Is it possible (and recommended) to increase the size and does anyone now how to do this ? (I still have to use 8.1.7)
    Thanks in advance,
    Bjoern

    First of all: you should mention it when you cross-post, to prevent people from wasting their time providing an answer already given in the other site.
    https://community.jboss.org/thread/223626
    Doing a google for "The stack size specified is too small, Specify at least 160k" gives plenty of reason to believe it is not really a 'problem', but simply a requirement of the JVM; how and why can only be answered by the developers of said JVM, you're not going to find them here because this is a user to user forum. And this isn't any different under Java 7.
    So other than downgrading, I don't see how you're going to make any impact. I would do the Google yourself, collect the search results that all indicate that the startup scripts are adjusted to the wishes of the JVM and present that to the vendor to shut them up. Anything more - well good luck getting an official statement from Oracle.

  • Help! VerifyError: stack size too large??

    I seem to have a class file with which the class file verifier has a complaint:
    D:\test\out>java Probe
    Exception in thread "main" java.lang.VerifyError: (class: Probe, method: main signature: ([Ljava/lang/String;)V) Stack size too large
    Can anybody point me towards documentation about what the algorithm is or should be to calculate the correct stack size. Or documentation on the message?
    I assume the meaning of the message is that the operand stack size is larger than used by the code for the static method main.  However, I haven't a clue as to the algorithm I should verify the size against. 
    Thanks for any help suggestions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Thanks for the suggestion. I am running a modified Class file and have read the jvm spec. I was hoping somebody would have a suggestion as to what the error message actually means...
    For example does this mean that the declared size of the operand stack is greater than that required by the code? Or perhaps that the declared size is too large for the code?
    The actual method is quite small (on the order of 500 instructions).
    I know that the jvm has a requirment that the operand stack have the same size along all control paths (loops, gotos, etc) to a specific instruction. I don't know what error the verifyer would give if this was the problem.
    Is there any documentation anywhere the verifier's error messages?
    Thanks for any help you can give.

  • Cannot increase the stack size

    Hi,
    We have a program which gives a StackOverflowError. Trying the increase the stack size using command line options does not work. A simple program shows that the stack is the same size, whatever option we set.
    This is the program:
    class StackOverflowTest
    public static int counter = 0;
    public static void main(String[] a)
    try {
    sub();
    } catch (StackOverflowError e)
    System.out.println("recursive calls: "+counter);
    public static void sub()
    counter++;
    sub();
    We tried several -Xss (and -Xoss) settings: 600K, 2048K, 4M but got the same recursion deep: 16683 (with Eclipse), or 16689 (command line).
    We used Windows XP.
    Do you have any clue?
    Many thanks,
    Zsolt

    Oh good, they seem to have broken the forum formatting again.
    ====================================================================================================================
    Bug ID:     4362291     Stack size argument ignored (-Xss and -ss)
    ====================================================================================================================
    public class StackOverflowTest {
        public static int counter = 0;
        public static final void main(String[] a) {
            new Thread(new Runnable() {
                public void run() {
                    try {
                        sub();
                    } catch (StackOverflowError e) {
                        System.out.println("recursive calls: "+counter);
            }).start();
        public static final void sub() {
         counter++;
         sub();
    /code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Change the default stack size in the java.exe file

    Does anyone know how to change the default stack size of the jvm?
    I'm having problems with my stack. Is there anyway I can change it. I found a tool editbin.exe which is shipped with Visual c++, however I don't have the tool.
    Thanks,
    William

    I am using JNI to connect java with a C++ application.
    When calling the C++ appliction, STACK_OVERFLOW
    happends. I tried java -Xss<size> to increase the
    stack size, but failed.This has nothing to do with the above question.
    Does anyone knows why?Probably because the java parameter specifies the java stack size and not the C++ stack size.

  • Default stack size vs. -Xss option

    Hi,
    What the default stack size?
    That is, if you use the -Xss<size> option, it will set the stack
    size to <size>, but what is the default. I've searched and only
    found one posting that says it is 256k.
    http://forum.java.sun.com/thread.jsp?forum=256&thread=40530
    Is that correct? Since this is a JVM option, is it platform
    dependant? In that case, what would it be on Win2k and Solaris?
    We are serializing graph objects and getting a StackOverflowError
    on occassion. There is a well known bug about this:
    http://developer.java.sun.com/developer/bugParade/bugs/4152790.html
    Thanks.
    --- Patrick

    Hi,
    It depends on version and OS.
    In Solaris there is in addition the OS restriction in ulimit
    or maxssiz in HP.
    hurricane% ulimit -a
    time(seconds) unlimited
    file(blocks) unlimited
    data(kbytes) unlimited
    stack(kbytes) 8192
    coredump(blocks) unlimited
    nofiles(descriptors) 4096
    vmemory(kbytes) unlimited
    Workaround - Use "ulimit -s 2048" in bash shell or "limit stacksize 2048" in tcsh to limit the initial thread stack to 2 MB.
    http://java.sun.com/docs/hotspot/VMOptions.html
    Check the link for the Solaris defaults.

  • BUG: Unable to increase stack size in OJVM

    Hi,
    I have a complex ADF Faces page (jspx) that has reached the level of complexity that I can reliably cause the JVM to die when running the page with:
    Fatal error: Cannot find class java/lang/StackOverflowError
    Process exited with exit code -1.when running within JDeveloper. I have tried adding
    -Xms1024m -Xmx1024m(yes, I know an outrageous stack size) to the project run properties, and it still crashes. However, if I change to the server JVM instead of ojvm, it works fine, even with a much smaller stack, although the default stack size will crash as well.
    So,
    1). Shouldn't -Xms and -Xmx work for OJVM? If not, this is going to be a pain when I need to debug, as OJVM rocks for that.
    2). Is there some way to configure ADF/OC4J so that I won't bomb like this? I'm guessing that the XML document (JSPX) is big enough that it's causing the XML parser to blow up. Just a guess however.
    Thanks,
    John

    It's unclear if the problems discussed happen after OJC compiles, or Javac compiles, or both. We have uncovered a bug in the compilation of jspx files using OJC. There is a chance that this bug fix will fix the problems mentioned. Email me at keimpe.bronkhorst AT oracle.com if you want to try out a patched OJC. This is not an OJVM fix, so if you compile with Javac, I can't help you at this time.
    Keimpe Bronkhorst
    JDev team

  • Checking stack size

    I have written a JNI app and it seems to work fine, but processing with very large files I run out of stack space.
    I have solved this issue for the moment by changing the stack size with the -Xss param to java but this is not the ideal issue because with even bigger files I still will have issues.
    So, I have 3 questions:
    1. Is there any way (in the c++ dll) to query the total stack size ?
    2. Is there any way to determine free (available) stack size ?
    3. Is there any way to increase the stack size when the dll is already running (if it starts to get low)
    I look forward to your thoughts
    Ding

    I have written a JNI app and it seems to workfine,
    but processing with very large files I run out
    of
    stack space.
    That suggests that you have a design problem.
    As a guess you are using recursion. Start by
    unrolling the recursion code to produce a
    non-recursive solution.ood Guess but there is no recursion in my code :-)
    While I am always trying to optimize my design, in
    this case I am constrained by 3rd party c libraries
    that are using very large multi dimensional arrays of
    doubles that are neccessary for lots of complicated
    math doing triangualtion of satellite data. So, I
    have no control over how much memory they want to
    consume.
    ood Guess but there is no recursion in my code :-)
    Then it is unclear as to what you think a good solution would entail.
    Do you intend to just to keep retrying the processing step with ever increasing stack sizes? Will that not impact the processing time? Why not just start with a larger stack size? And if the stack size just continues to grow because the file sizes are continuing to grow then what?
    While I am always trying to optimize my design, in
    this case I am constrained by 3rd party c libraries
    that are using very large multi dimensional arrays of
    doubles that are neccessary for lots of complicated
    math doing triangualtion of satellite data. So, I
    have no control over how much memory they want to
    consume.
    One solution would be to create a C app, not a java one. Find the maximum amount of stack space that you can allocate via a C app and still operate (this depends on what happens with the file itself.) The output goes to a file.
    Your java app just starts that in a separate process space.
    >>
    >
    I was referring to the native C stack, used within
    the c++ dll, for which the java VM starts via the
    -Vss flag. I know the initial total as I am setting
    it at runtime. I just wanted to print the value from
    within the dll. #2 (below) is more important
    though.
    That would depend on your OS and compiler.
    2. Is there any way to determine free(available)
    stack size ? This is the part I was mostly hoping for an answer
    to, as I need to communicate with the parent java app
    if the stack space gets too low, instead of just
    allowing the dll to crash when it runs out
    That is a two part question. You want to know the size and you want to know if it gets 'too low'.
    You suggested that this is all stack based processsing. So unless you have C methods that are called by the library and in addition it is recursive in nature then this is not possible. There is no point where you could detect it.
    You can analyze the file yourself and compute a size before you start processing. But if that is what you are doing then you should do it first and let the java app know the result.
    Other than that most OSes allow you to catch 'system exceptions' (which might or might not be actual C++ exceptions.) One of these would be generated when the stack overflows.
    You then convert into something that java understands.
    For example in Windows there is a function that allows you to set up system exceptions so that they cause a C++ exception to be thrown. You would then catch this exception and convert it into a java exception.
    That lets you know that it didn't work but then what?
    For example in windows you can create a custom stack for the dll but only when the dll loads (so far as I know.) So to restart this you would have to unload the dll and that means that you will have to have everything wrapped in a custom class loader (which is the only way to cause a dll to be unloaded.)
    Not to mention that in my experience the windows function that I mentioned above doesn't necessarily always catch everything.
    >>>
    >>
    No. The VM must be restarted.if that is true, It i a bummer :(You can however, on most OSes, increase the stack size for the shared library. This is done on start up of the shared library. To resize it however means that the shared library must be reloaded. And the only way you can do that in the Sun VM is with a class loader.

  • Max-stack-size - default_stksize

    Hi,
    First, sorry for my english ^^
    I'm new on Solaris. I installed Solaris 10 on Sun V490 . I use Core Network.
    Why with the default setting, daemons or process of the OS "don't work" like this:
    Jun 17 14:50:10 unknown genunix: [ID 883052 kern.notice] basic rctl process.max-stack-size (value 8683520) exceeded by process 353In this example I generate the error with the format command. But I get this error with other command or deamon like nscd.
    I had the same problem with the value max-file-descriptor. The values set by projmod for the system project did not seem take effect. Thus I used the "old" parameters rlim_fd_cur, rlim_fd_max. Now it's ok.
    I find this parameter default_stksize in the Sun documentation. I put this in my /etc/system file:
    set default_stksize=16384At the boot time I have no error message for the value, but the max-stack-size value is the same:
    prctl -n process.max-stack-size 130
    process: 130: /usr/sbin/nscd
    NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
    process.max-stack-size
    basic 8,28MB - deny 130
    privileged 127MB - deny -
    system 2,00GB max deny -
    nscd is in the system project:
    ps -p 130 -o project
    PROJECT
    system
    Thank in advance, any idea is welcome.
    Guillaume

    Hi Prasad,
    Block Size is the number of parallel processes that are being executed in background during the application.  This is normally a configuration activity to be configured in line with basis.
    In Block size, we enter the number of objects to be processed per block by the CIF comparison/reconciliation during data selection in SAP APO or in the partner system.
    If you increase the block size, the memory required also increases. This has a positive effect on performance. If processes are cancelled due to lack of memory, you can decrease the block size to save memory.
    If you do not enter anything here, the system determines the block size dynamically from the number of objects that actually exist and the maximum number of work processes available.
    Normally, when you execute a job in background, it picks up the application server automatically or by manually defined server.  In parallel processing, at a time, one or more job of the same identify can be triggered under this scenario by defining application servers.  But too many parallel processing activity will affect the performance.
    One needs to define the parallel processes also to control system behaviour.  The Parallel processing profile is defined for parallel processing of background jobs. You then assign these profiles to variants in the applications.
    Regards
    R. Senthil Mareeswaran.

  • Monitor thread stacks in JVM

    Hi,
    I've a problem with my app, when my server runs for a long time, the memory used by the java process increases.
    I investigate this : the use of the heap seems to be good (no memory leak), i've used pmap for retreiving the use of memory by my process and i've seen that the number of range of memory reserved for [anon] increases (about 520K each times).
    I think that it is thread stack reserved but not freed.
    My question is : How can i link a memory address reservation with a thread (if it's possible) ??
    I use a JDK 1.5.0_10 un der RedHat Enterprise 3 Updt 4.
    Thanks

    pls tell me thread running in jvm or operating systemIIRC, unless you are using a very old JVM (e.g. pre 1.2) or are explicitly specifying green threads (which I believe was still possible even in 1.2?) then all threading using native threads. As mentioned above, the mapping between Java thread objects and the native threads is is highly dependent on the OS (especially when it comes to thread priority).
    This document goes into much more detail: http://java.sun.com/docs/hotspot/threads/threads.html
    - N

Maybe you are looking for