Last modified by David Avendasora on 2010/11/30 06:43

From version 6.1
edited by Jonathan 'Wolf' Rentzsch
on 2009/02/03 16:54
Change comment: There is no comment for this version
To version 3.1
edited by Quinton Dolan
on 2007/07/14 21:28
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -Web Applications-Deployment-Debugging Frozen Deployed Instances
1 +Programming__WebObjects-Web Applications-Deployment-Debugging Frozen Deployed Instances
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.rentzsch
1 +XWiki.qdolan
Content
... ... @@ -1,13 +1,15 @@
1 -This article was written by Andrew Lindesay ([[http://www.lindesay.co.nz]]) around February 2005. It first appeared as LaTeX PDF and has been transcribed into this Wiki. You use the information contained in this document at your own risk. Please contact the author if you feel there may have been an error in the conversion to Wiki markup.
1 +This article was written by Andrew Lindesay (http:~/~/www.lindesay.co.nz) around February 2005. It first appeared as LaTeX PDF and has been transcribed into this Wiki. You use the information contained in this document at your own risk. Please contact the author if you feel there may have been an error in the conversion to Wiki markup.
2 2  
3 -|= Contents
4 -| {{toc style="disc"}}{{/toc}}
3 +|=Contents
4 +|
5 5  
6 -= Applicability =
6 +{{toc style="disc"}}{{/toc}}
7 7  
8 += Applicability =
9 +
8 8  The material discussed here has been used with WebObjects 5 and Java 1.4 on MacOS-X Server. It may or may not work on older or newer versions of WebObjects or Java. It is strongly suggested that you test this on a non-production server first. Note that there may be security issues with this technique if your system is exposed on the internet.
9 9  
10 -= Introduction =
12 += Introduction =
11 11  
12 12  Java provides the substrate upon which WebObjects 5 applications operate. Java has it's good and bad points. One good point is the ease with which one can achieve threaded operation of a software system. This can often be used to make the most of your hardware assets, but also means you need to ensure that things are locked to prevent two threads getting at the same thing at the same time. Locking failures can lead to data getting damaged or when one thread won't let a lock go for some reason, other threads can be left waiting indefinitely.
13 13  
... ... @@ -17,7 +17,7 @@
17 17  
18 18  This article focuses on a technique that can be used to ascertain what is going on inside a frozen instance in a production environment. In particular this technique will obtain for you a stack-trace of the instances' threads. Armed with this information, you are much better placed to diagnose the issue and fix it quickly.
19 19  
20 -= Before you Start =
22 += Before you Start =
21 21  
22 22  A WebObjects system which is deployed in the traditional manner consists of a number of copies of the program running separately, each carrying some of the inbound load from users. Each of these 'copies' is termed an instance. The ##SiteConfig.xml## file defines the instances. This configuration file is located at the following place in your MacOS-X Server's file system.
23 23  
... ... @@ -29,9 +29,9 @@
29 29  
30 30  Before you modify it, make a backup of the ##SiteConfig.xml## file in case anything goes wrong.
31 31  
32 -= Setup =
34 += Setup =
33 33  
34 -The instances are modified such that they are able to be connected to remotely using the ##jdb## debugging tool. Some "additional arguments" need to be inserted into the configuration in the ##SiteConfig.xml## file for each instance in order to achieve this. These additional arguments are inserted as shown below in the text of the element ##additionalArgs##. You will need to choose a different address for each instance - choose addresses from 8000 - 8999. This is a TCP/IP port. Note that the additional arguments should all appear on one continuous line. The author has split this up here to improve readability.
36 +The instances are modified such that they are able to be connected to remotely using the ##jdb## debugging tool. Some "additional arguments" need to be inserted into the configuration in the ##SiteConfig.xml## file for each instance in order to achieve this. These additional arguments are inserted as shown below in the text of the element ##additionalArgs##. You will need to choose a different address for each instance ~-~- choose addresses from 8000 - 8999. This is a TCP/IP port. Note that the additional arguments should all appear on one continuous line. The author has split this up here to improve readability.
35 35  
36 36  {{code value="xml"}}
37 37  
... ... @@ -56,16 +56,8 @@
56 56  
57 57  Now restart your instances.
58 58  
59 -Note that some JVM's on other platforms expect the "jdwp" to be specified as follows;
61 += When Something Goes Wrong... =
60 60  
61 -{{noformat}}
62 -
63 --agentlib:jdwp=transport=dt_socket,address=8121,server=y,suspend
64 -
65 -{{/noformat}}
66 -
67 -= When Something Goes Wrong... =
68 -
69 69  The instances are listed in the JavaMonitor. A screenshot is shown below with the instance number circled in red. You need to first identify which instance has frozen.
70 70  
71 71  [[image:Monitor-with-instances.gif]]
... ... @@ -94,20 +94,6 @@
94 94  
95 95  = What to Look For =
96 96  
97 -##jdb##'s ##watch all## command will give you a stack trace for all threads in your app. But your process needs first to be suspended in order to get a coherent stack trace. Use it like so:
98 -
99 -{{noformat}}
100 -
101 -> suspend
102 -All threads suspended.
103 -> where all
104 -...
105 -> suspend
106 -All threads suspended.
107 ->
108 -
109 -{{/noformat}}
110 -
111 111  An example of a stack trace is shown below. You'll notice the java class name and source-code line number at the end of a particular entry in the stack. Here we can see that the thread called "WorkerThread103" has stuck trying to get a session from the session store. In this situation another thread will most likely have the session store locked and is not releasing the lock.
112 112  
113 113  {{noformat}}
... ... @@ -117,7 +117,7 @@
117 117   [2] java.lang.Object.wait (Object.java:429)
118 118   [3] com.webobjects.appserver.WOSessionStore.checkOutSessionWithID (WOSessionStore.java:207)
119 119   [4] com.webobjects.appserver.WOApplication.restoreSessionWithID (WOApplication.java:1,546)
120 - [5] com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication
100 + [5] com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication
121 121  (WOComponentRequestHandler.java:314)
122 122   [6] com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest (WOComponentRequestHandler.java:358)
123 123   [7] com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest (WOComponentRequestHandler.java:432)
... ... @@ -142,7 +142,3 @@
142 142  = Conclusion =
143 143  
144 144  Despite the simplicity of this approach, it provides for a means by which you can find out what is going on inside frozen instances rather than playing laborious guessing games.
145 -
146 -= Alternative Approaches =
147 -
148 -[[http://www.gvcsitemaker.com/gvc.webobjects/faq&mode=single&recordID=41413]]