https://www.ibm.com/developerworks/community/blogs/cdd16df5-7bb8-4ef1-bcb9-cefb1dd40581/entry/webgui_outofmemoryexceptions_don_t_panic_and_here_s_what_to_do9?lang=en
WebGUI is a fairly complex enterprise Java application. Because of this, it is sensitive to incorrect sizing and hardware capabilities of the server it is running on. This blog post will address what you can do when WebGUI runs out of memory. A sure tell-tale sign of this is the dreaded OutO fMem oryE xcep tion s (OOMs) in various log files. OOMs are never good thing to see in your log files as they will often cause unpredicatable failures.
First you'll need to decide if this is a simple sizing issue or something else altogether. The easiest way to do this is to simply bump up the amount of Java memory available to WebGUI (without exceeding your server's physical memory). You can do this by using the wsadmin command or by manually editing a server.xml file. I'll outline how to do both.
Memory settings (and other JVM parameters) are stored in <ins tall _dir >/pr ofil es/T IPPr ofil e/co nfig /cel ls/T IPCe ll/n odes /TIP Node /ser vers /ser ver1 /ser ver. xml. E.g.
Doing either of these will require a restart of WebGUI. Once the new memory settings have taken effect, monitor WebGUI to see if the issues persist. If they do, see if OOMs are in the log files (ncw.* or webtop.log, depending on which version of WebGUI you are running). Let's assume the issues persist, what next?
At this point, you can try to increase memory further, to see if the issue still occurs. But keep in mind that if you are on a 32-bit operating system, there is a hard-limit of 4GB for each process, including the JVM, so check your OS documentation on the recommended Java -Xmx setting to use (typically it's around 3GB for a 32-bit OS). If you're on a 64-bit OS and have set it to a relatively high number (e.g. >4GB, assuming your server has more than 4GB of memory available) but are still seeing OOMs, it's time to gather a bit of information before deciding your next move.
I won't delve too deep into the various types of memory one should be concerned about when running a Java application, as doing that will risk running this blog post into a small book. I'll direct you instead to an article on DeveloperWorks. Safe to say that should you run out of native memory, allocating more memory to Java heap will only make matters worse. There are a tell-tale signs that native memory has been exhausted:
A Java core is a formatted and pre-analyzed text file created by the JVM during an event (in our case - the OOM), or via manual intervention. It contains a lot of information about the runtime condition of the JVM during a snapshot in time, but you should only be interested in the first few lines. Use your favorite file search tool to look for the files with the following names: javacore.* and you should be able to find a bunch of text files. Open them in a text editor and you should see the following. Pay attention to the line which has '1TISIGINFO' in it, as it contains the dump event reason.
You'll notice that the reason for java /lan g/Ou tOfM emor yErr or is "Failed to create a thread: ...". If you see this error message it is likely that you've run out of native memory.
Another indication is by examining a Java heap dump generated during the OOM. A heap dump is a binary file, containing a dump of all reachable objects in memory at a certain point in time. It's typically used to examine what objects are occupying memory, handy if you've got an OOM. To examine a heap dump, I recommend a tool called Eclipse Memory Analyzer. If you need to analyze an IBM heapdump, you'll need an additional IBM plugin for MAT. Open up the heap dump using the tool and see what's the size of the heap. If it is significantly smaller than the amount of memory allocated to Java (via -Xmx command or wsadmin), then you have probably run out of native memory. E.g. if you've allocated 2GB, but get an OOM and the heap shows only 1GB of heap successfully allocated.
If no heap dumps are being generated, you'll need to set the following environment variables (refer to your OS documentation on how to set them):
The next time an OOM occurs, heap dumps will be generated in the directory you specified. You do not need to restart TIP for this to take effect.
Yet another handy way to know if the culprit is lack of native memory is to look at WebGUI's error logs (either ncw.*.trace for WebGUI 7.3.1 and above, or webtop.log for WebGUI 7.3.0 and below). Look for the line that contains the stack trace of the OutO fMem oryE xcep tion . Here are 2 examples:
Exceptions occuring during allocation of memory in DirectByteBuffer and failure to create new native thread (similar error to the Java core file above) are typical examples of running out of native memory.
At this point, I advise upgrading your version of WebGUI or Webtop and/or installing fix packs. Recent versions have critical bugs related to memory consumption. If you still have issues after upgrading, then contact IBM support engineers with the following information:
WebGUI is a fairly complex enterprise Java application. Because of this, it is sensitive to incorrect sizing and hardware capabilities of the server it is running on. This blog post will address what you can do when WebGUI runs out of memory. A sure tell-tale sign of this is the dreaded OutO
1. Increase WebGUI's (Java) Available Memory
1.1 wsadmin
bash-2.05$ cd <tip_home>/bin
bash-2.05$ ./wsadmin.sh -lang jython -username <admin_username> -password <password>
wsad min> Admi nTas k.se tJVM Init ialH eapS ize ('[-serverName server1 -nodeName TIPNode -initialHeapSize 1024]')
wsad min> Admi nCon fig. save ()
wsad min> Admi nTas k.se tJVM MaxH eapS ize( '[-s erve rNam e server1 -nodeName TIPNode -maximumHeapSize 2048]')
wsad min> Admi nCon fig. save ()
wsad min> Admi nTas k.sh owJV MPro pert ies( '[-s erve rNam e server1 -nodeName TIPNode]')
'[ [int erna lCla ssAc cess Mode ALLOW] [debugArgs -Dja va.c ompi ler= NONE -Xdebug -Xnoagent -Xru njdw p:tr ansp ort= dt_s ocke t,se rver =y,s uspe nd=n ,add ress =350 50] [classpath ] [initialHeapSize 768] [runHProf false] [gen eric JvmA rgum ents ] [hprofArguments ] [osName ] [bootClasspath ] [verboseModeJNI false] [maximumHeapSize 1152] [disableJIT false] [exe cuta bleJ arFi leNa me ] [ver bose Mode Garb ageC olle ctio n false] [debugMode false] [verboseModeClass false] ]'
bash-2.05$ ./wsadmin.sh -lang jython -username <admin_username> -password <password>
wsad
wsad
wsad
wsad
wsad
'[ [int
1.2 server.xml
Memory settings (and other JVM parameters) are stored in <ins
<jvmEntries xmi: id=" Java Virt ualM achi ne_1 2709 5342 4359 " verb oseM odeC lass ="fa lse" verb oseM odeG arba geCo llec tion ="fa lse" verb oseM odeJ NI=" fals e" init ialH eapS ize= "768 " maxi mumH eapS ize= "115 2" runHProf="false" hprofArguments="" debugMode="false" debu gArg s="- Djav a.co mpil er=N ONE -Xdebug -Xnoagent -Xru njdw p:tr ansp ort= dt_s ocke t,se rver =y,s uspe nd=n ,add ress =350 50" gene ricJ vmAr gume nts= "">
<systemProperties xmi: id=" Prop erty _127 0954 1928 61" name ="co m.ib m.ti voli .rep orti ng.i nsta lldi r" valu e="/ home /jef fri/ buil d/22 /pro duct s/tc r" description="Tivoli Common Reporting Home" required="false"/>
</jvmEntries>
<systemProperties xmi:
</jvmEntries>
Doing either of these will require a restart of WebGUI. Once the new memory settings have taken effect, monitor WebGUI to see if the issues persist. If they do, see if OOMs are in the log files (ncw.* or webtop.log, depending on which version of WebGUI you are running). Let's assume the issues persist, what next?
At this point, you can try to increase memory further, to see if the issue still occurs. But keep in mind that if you are on a 32-bit operating system, there is a hard-limit of 4GB for each process, including the JVM, so check your OS documentation on the recommended Java -Xmx setting to use (typically it's around 3GB for a 32-bit OS). If you're on a 64-bit OS and have set it to a relatively high number (e.g. >4GB, assuming your server has more than 4GB of memory available) but are still seeing OOMs, it's time to gather a bit of information before deciding your next move.
2. Determine if you've run out of native memory
- 1TISIGINFO in Java core
- heap dumps
- Java stack trace
- heap dumps
- Java stack trace
2.1 Java core
NULL ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
0SECTION TITLE subcomponent dump routine
NULL ==== ==== ==== ==== ==== ==== ==== ===
1TISIGINFO Dump Event "systhrow" (00040000) Detail "jav a/la ng/O utOf Memo ryEr ror" "Failed to create a thread: retVal -1073741830, errno 11" received
1TIDATETIME Date : 2011/09/22 at 16:03:57
1TIFILENAME Javacore filename: /usr /tiv oli/ tip/ prof iles /TIP Prof ile/ java core .201 1092 2.16 0347 .216 2704 6.00 05.t xt
NULL ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
0SECTION TITLE subcomponent dump routine
NULL ====
1TISIGINFO Dump Event "systhrow" (00040000) Detail "jav
1TIDATETIME Date
1TIFILENAME Javacore filename: /usr
NULL ----
You'll notice that the reason for java
2.2 Heap Dump
If no heap dumps are being generated, you'll need to set the following environment variables (refer to your OS documentation on how to set them):
IBM_HEAP_DUMP=true
IBM_HEAPDUMP=true
IBM_ HEAP DUMP _OUT OFME MORY =tru e
IBM_ JAVA CORE _OUT OFME MORY =tru e
IBM_ HEAP DUMP DIR= <dir ecto ry>
IBM_HEAPDUMP=true
IBM_
IBM_
IBM_
The next time an OOM occurs, heap dumps will be generated in the directory you specified. You do not need to restart TIP for this to take effect.
2.3 Java stack trace
Allocated 1953546760 bytes of native memory before running out
Exception in thread "main" java .lan g.Ou tOfM emor yErr or
at sun. misc .Uns afe. allo cate Memo ry(N ativ e Method)
at java .nio .Dir ectB yteB uffe r.<i nit> (Dir ectB yteB uffe r.ja va:9 9)
at java .nio .Byt eBuf fer. allo cate Dire ct(B yteB uffe r.ja va:2 88)
at com. ibm. jtc. demo s.Di rect Byte Buff erUn derN ativ eSta rvat ion. main (
Dire ctBy teBu ffer Unde rNat iveS tarv atio n.ja va:2 9)
Allocated 1953546736 bytes of native memory before running out
Exception in thread "main" java .lan g.Ou tOfM emor yErr or: unable to create new native thread
at java .lan g.Th read .sta rt0( Nati ve Method)
at java .lan g.Th read .sta rt(T hrea d.ja va:5 74)
at com. ibm. jtc. demo s.St arti ngAT hrea dUnd erNa tive Star vati on.m ain(
Star ting AThr eadU nder Nati veSt arva tion .jav a:22 )
Exception in thread "main" java
at sun.
at java
at java
at com.
Dire
Allocated 1953546736 bytes of native memory before running out
Exception in thread "main" java
at java
at java
at com.
Star
Exceptions occuring during allocation of memory in DirectByteBuffer and failure to create new native thread (similar error to the Java core file above) are typical examples of running out of native memory.
If you determined that you need more native memory, you should either add more physical memory and/or reduce the number of applications running concurrently on the server. Hint: It's generally a bad idea if you're running WebGUI and ObjectServer in the same physical machine. Keep in mind that if you plan to use >4GB of memory, you'll need a 64-bit OS. Once you've added more memory and increase the Java heap available to WebGUI, continue monitoring to see if the issue still occurs.
3. Help! There's plenty of native memory, I've increased Java heap, but I still get OOMs
- WebGUI configuration information:
- ncwD
ataS ourc eDef init ions .xm l - wim
conf ig.x m l - Out
put from 'Troubleshooting and Support > System Information for Tivoli Netcool/OMNIbus Web GUI'
- WebGUI server logs in $TIP
HOME \pro file s\TI PPro file \log s - Jav
a heap dumps (or Eclipse Memory Analyzer reports if you've previously analyzed a heap dump) - Java core files
No comments:
Post a Comment