Re: my execute method of action class is getting executed twice
I think you should check if it's the browser that submits the form two times. I thought was a bug of my application, but now i'm thinking it's a bug of struts 2 framework. I hope will be fix very soon. Regards Andrea xniit2003 wrote: Hi, I am new in struts2. In my action class I declared some global fields and one execute method.This class extends another class, which extends Actionsupport class. Now my execute method is getting processed twice. From this execute method, execution goes to some other method, which also getting processed twice. Can anyone faced similar situation. -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP EL on struts2 tags
mi dispiace ma non ho mai usato le funzioni di localizzazione. Consiglio pero' di controllare i linguaggi consentiti dal browser. Probabilmente viene usato il primo (se ce n'e' piu' di uno) e forse il default per il primo e' l'inglese. Il giorno 30/nov/07, alle ore 16:47, giglian ha scritto: vedo che stai utilizzando Struts 2. io ho un problema con la localization. praticamente pur avendo due files di properties (package.properties (inglese) e package_it.properties (italiano)) le pagine jsp (dove utilizzo il tag s:text name=../ ) mi compaiono sempre nella lingua del sistema operativo anzichè nella lingua del client (IE 6). ti comunico il mio recapito telefonico, eventualmente ci possiamo sentire. saluti Andrea Gigliotti (tel. 0583 700275) Andrea Vettori wrote: Hi, It's long time I was away from this list. I've found with big surprise that JSP EL is not available in JSP tags anymore. I've looked at the release notes and found it was because of a security problem similar to one I've discovered some time ago. What I haven't understand is : If in the JSP page I use ONLY page variables into EL (that is don't use request variables) do the problem still exist ? Thank you -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/JSP-EL-on-struts2-tags-tf4897752.html#a14074290 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JSP EL on struts2 tags
Hi, It's long time I was away from this list. I've found with big surprise that JSP EL is not available in JSP tags anymore. I've looked at the release notes and found it was because of a security problem similar to one I've discovered some time ago. What I haven't understand is : If in the JSP page I use ONLY page variables into EL (that is don't use request variables) do the problem still exist ? Thank you -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
slowing down action execution time
Hi what's the best method to slow an action execution time ? Something like Thread.sleep(...). Thanks ! -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: slowing down action execution time
I need to initially slow down and after a few minutes completely block access to aa site to logged-users and/or remote ip addresses that reads too many pages too fast. It's something like controlling that the site is not mirrored. I don't remember where but I think I read somewhere that's not possibile to call Thread methods inside a servlet container. Anyone can confirm this ? Thanks Il giorno 17/lug/07, alle ore 16:25, Leon Rosenberg ha scritto: actually you named it. Thread.sleep(). only for debugging purposes of course :-) regards leon On 7/17/07, Ing. Andrea Vettori [EMAIL PROTECTED] wrote: Hi what's the best method to slow an action execution time ? Something like Thread.sleep(...). Thanks ! -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: slowing down action execution time
thanks to all I'll try... Il giorno 17/lug/07, alle ore 16:38, Antonio Petrelli ha scritto: 2007/7/17, Ing. Andrea Vettori [EMAIL PROTECTED]: I don't remember where but I think I read somewhere that's not possibile to call Thread methods inside a servlet container. Anyone can confirm this ? AFAIK you cannot create any thread in a Java EE environment (though products like Quartz do this very elegantly), but I think that you can do anything with your *current* thread. Antonio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preventing OGNL evaluations of user input (was Re: Struts 2 performance)
It's already known and a patch already exists. https://issues.apache.org/struts/browse/WW-2030 Don't know when a patched version will be released. Il giorno 16/lug/07, alle ore 10:29, Aram Mkhitaryan ha scritto: Should someone create a ticket in jira? I guess it is really a huge problem. Best, Aram Aram Mkhitaryan 52, 25 Lvovyan, Yerevan 375000, Armenia Mobile: +374 91 518456 E-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preventing OGNL evaluations of user input (was Re: Struts 2 performance)
The patch works the only problem is if you need to accept %{xxx} as legal input from your users. To apply the patch you need to download xwork sources, apply the patch (with the patch command or manually if you don't have it since there are few lines of code) and insert a couple of lines on struts.xml. Recompile xwork and use that jar instead of the jar distributed with struts. Il giorno 16/lug/07, alle ore 10:44, Aram Mkhitaryan ha scritto: Sorry guys for spamming, but it is not clear what the patch exactly resolves. disallow entering possible malicious code, i.e. expression like % {xxx} is illegal: instead it should be evaluated as the string %{xxx}. what means the first is illegal, but should be evaluated as the string could you please bring an example with s:property tag? Best, Aram P.S. do you have a guide about how to apply patches? Aram Mkhitaryan 52, 25 Lvovyan, Yerevan 375000, Armenia Mobile: +374 91 518456 E-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preventing OGNL evaluations of user input (was Re: Struts 2 performance)
Take a look at the jira issue, it's something I suggested too. We should disable by default evaluation of expressions when they are an input from the user (i.e. parameters to an action) and enable by default expression when specified as parameters to tags. Il giorno 16/lug/07, alle ore 11:29, Aram Mkhitaryan ha scritto: Actually that patch is not a solution, definitely. The solution could be: disable evaluation by default, add a hint to enable evaluation. for example old---s:property value=%{amount} / solution--- s:property value=eval/%{amount} i suggest this solution since s:property value=%{amount} / and s:property value=amount / should output the same. am I wrong? also because for the most of the cases just attribute values should be printed and not evaluated the content (note: the initial problem was the s2 performance) Best, Aram Aram Mkhitaryan 52, 25 Lvovyan, Yerevan 375000, Armenia Mobile: +374 91 518456 E-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preventing OGNL evaluations of user input (was Re: Struts 2 performance)
The parameter is removed so it's like your input an empty string. Il giorno 16/lug/07, alle ore 11:36, Aram Mkhitaryan ha scritto: Thanks for the response, so if I type in my text input %{..System.exit(0);} it will not shut my server down, but what will happen? will I get errors or just the text will not be evaluated? Best, Aram Aram Mkhitaryan 52, 25 Lvovyan, Yerevan 375000, Armenia Mobile: +374 91 518456 E-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preventing OGNL evaluations of user input (was Re: Struts 2 performance)
Sorry that I'm asking the same again, but this is the fastest way to know the truth so currently (without patches), s:property value=propName / just prints the propName property, but s:property value=%{propName} / evaluates the expression in %{} and if propName=amout, it prints the amout property? No, s:property value=%{propName}”/ should be equivalent to s:property value=propName/. I think You'll get the second behaviour with s:property value=%{% {propName}}/ -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 performance
Yes i'm sure it's true. So the struts related performance seems not too bad... Il giorno 12/lug/07, alle ore 14:02, Al Sutton ha scritto: Try using a some dummy beans for your MP3 test that return known data, that way you can get a good idea of the impact your database has on the response time. I suspect you'll find that your DB is causing a lot of the delay in the short ramp up test. -Original Message- From: Ing. Andrea Vettori [mailto:[EMAIL PROTECTED] Sent: 12 July 2007 11:30 To: Struts Users Mailing List Subject: Re: Struts 2 performance I've done some measurements with jmeter on my e-commerce site built on struts2 and ejb3. 1 user (testing) === Home page, http://www.elettrotop.com/ElettroTop/Home.action average response time : 63 msec MP3s list, http://www.elettrotop.com//ElettroTop/RicercaArticoliAlbero.action? path=AUDP ERMP3 average response time : 360 msec 100 users, ramp-up 200 seconds (average load) Home page, http://www.elettrotop.com/ElettroTop/Home.action average response time : 72 msec MP3s list, http://www.elettrotop.com//ElettroTop/RicercaArticoliAlbero.action? path=AUDP ERMP3 average response time : 378 msec 100 users, ramp-up 10 seconds (high-load) == Home page, http://www.elettrotop.com/ElettroTop/Home.action average response time : 59 msec throughput: 597 / minute MP3s list, http://www.elettrotop.com//ElettroTop/RicercaArticoliAlbero.action? path=AUDP ERMP3 average response time : 2,7 seconds throughput: 261 / minute The home page is moderately complex but it uses almost all cached data. The MP3s list loads from the db about 270 product records and shows the first 10. Most views component are produced using jsp custom tags so OGNL is used only on the back-end by struts itself and not by jsp pages. The site is using the simple theme. Any considerations on the numbers ? -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 performance
2007/7/12, Ing. Andrea Vettori [EMAIL PROTECTED]: Yes i'm sure it's true. So the struts related performance seems not too bad... compared to what? Compared to nothing... they are pure numbers. They are simply just good enought (to me). If we don't have this in mind we should use assember for everything :) In the high load test, after 10 seconds you have about 90 users (the other 10 should have finished). Having a response time of 2,5 seconds for a db search and result display under such load seems very good to me. Don't you ? -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 performance
Il giorno 12/lug/07, alle ore 16:31, Guillaume Carré ha scritto: 2007/7/12, Ing. Andrea Vettori [EMAIL PROTECTED]: Compared to nothing... they are pure numbers. They are simply just good enought (to me). If we don't have this in mind we should use assember for everything :) what I meant was: maybe it could be a good idea to redevelop your screens with, say struts 1 for example, and compare the results I can't do that... simply don't have the time... :) In the high load test, after 10 seconds you have about 90 users (the other 10 should have finished). Having a response time of 2,5 seconds for a db search and result display under such load seems very good to me. Don't you ? it depends :-) 2.5s doesn't say much to me, I would need to know how much time is consumed in your DB requests, how much time is consumed in your service layer, etc etc. Is it 90 users really active at the same time, meaning using 90 threads on the server?if it is, do you have at least 90 connections in your pool? or did you put think times in your tests? No think time... I have 250 threads but I have a limit of 50 connections on my pool. I'll try to raise the number of maximum connection to see if the MP3 list test gets better. However I think that struts alone is performing well for my app; don't know if it's because i'm using only few OGNL expressions on my jsp pages. -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 performance
I'm using s2 2.0.8 on an e-commerce site. The site is very new so we have about 3000 sessions a day but I don't have performance problems... The pages are loading quickly. The most used pages are - the products listing that gets data from a session bean and displays rows of information - the product details that gets an xml from a session bean and displays it after transforming it with xslt. Can anyone suggest how to test my site for performance analysis (best with a simple free product) ? I can show here the result if interested. I also think we should have a test application that minimizes memory/cpu utilization for non-struct components and some pre-defined tests so we can produce benchmarks we can compare... -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 performance
I think that the s2 app should have more than one version depending on the used template. I think the test app should have - listing rows from a database - displaying row details These should be the most used pattern used on many sites and it can be also a part of a CRUD application. Add an input form and I think you have a good starting point to make some benchmarks. I think the backend datastore should be in-memory and pre-loaded before making any measurement. Il giorno 11/lug/07, alle ore 16:21, Leon Rosenberg ha scritto: hmm, if someone would specify a valid test-case or test-app, i'd volunteer to implement it in both s1 and s2 and measure the points where the performance is lost exactly. /2cents Leon On 7/11/07, Musachy Barroso [EMAIL PROTECTED] wrote: I think so far a couple of people have tried to decouple Struts 2 from OGNL, (so other libs like MVEL could be used), so far no patch has made it through :) As for 2.1, the other day when Ted posted the numbers about the download spike it made think that even with so many people downloading/ using S2, we are not getting many contributions/contributors and development overall seems very slow. I know that's the nature of OSS, but we could use some help right now. regards musachy On 7/11/07, Ted Husted [EMAIL PROTECTED] wrote: On 7/11/07, Aram Mkhitaryan [EMAIL PROTECTED] wrote: Look here https://issues.apache.org/struts/browse/WW-1673 and references there. Maybe we can push those tickets to be fixed earlier, since it is not clear when the mentioned version 2.1.x will be released. Does someone know how we can do that? I think the underlying problem is no one is sure how to proceed. There have been several suggestion as to replacing OGNL and/or FreeMarker, but no clear winner has emerged. * http://www.nabble.com/The-performance-issue-about-OGNL- tf3291137.html#a9154137 * http://www.nabble.com/OGNL-performance-detrimental-to-Struts-2- tf2804655.html#a7825136 * http://www.nabble.com/Abstracting-Ognl-from-XWork-and-Struts-2-- tf2355393.html#a6561815 (and now) * http://www.nabble.com/Struts-2-performance- tf4053401.html#a11536097 Technology aside, the key ingredient is one or more volunteers who are are ready, willing, and able to do the work. A good place to start would be summarize the prior threads and post the summary here and on the JIRA ticket. We also could use a benchmark test that people in the project could check out from SVN and run locally. We do have one contribution in that regard, but it needs to be ported from WW to S2. * https://issues.apache.org/struts/browse/WW-1560 HTH, Ted. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 requires input result on failed type conversion
it's not what you want but why don't use String getter/setter on the action and do the conversion later ? Il giorno 11/lug/07, alle ore 18:37, Martin Simons ha scritto: Hi everybody, this is my first mailing list :-) I'm currently developing a web-app based on Struts 2. My visitors are mainly German and whenever they enter numbers, they usually type a decimal number like 1,23 instead of 1.23. If the setter of the action requires a double, type conversion will fail and ask for an input result. For historic reasons this doesn't exist in my application. Input errors are handled separately and if type conversion fails, null or 0 is expected. How can I get Struts to use this behaviour, or even better, cast a comma- separated decimal to a double correctly. Thanks for your help, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Disabling OGNL
Don't think it's possibile since it is used by struts internally. Il giorno 11/lug/07, alle ore 18:47, Perssy Llamosas ha scritto: I am using JSP 2.1 EL rather than the OGNL but I believe OGNL is adding extra processing time I don't really require since it appears in the profiler. Is there a way to remove the dependency? I see this document: http://cwiki.apache.org/WW/ognl.html#OGNL-JSP2.1 But I want to disable OGNL not JSP 2.1 EL. Perssy Llamosas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Struts 2 requires input result on failed type conversion
I haven't tried but it seems possibile http://struts.apache.org/2.0.8/docs/type-conversion.html Il giorno 11/lug/07, alle ore 18:55, Martin Simons ha scritto: Well, the app has grown for quite some time now and consists of a lot of actions. Touching all of the them and exchanging all number-setters with some kind of string parsing would be a whole lot of work. So my favourite solution would be something that easily achieved by struts default functionality. After all, this problem doesn't seem too exotic :) -Ursprüngliche Nachricht- Von: Ing. Andrea Vettori [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 11. Juli 2007 18:47 An: Struts Users Mailing List Betreff: Re: Struts 2 requires input result on failed type conversion it's not what you want but why don't use String getter/setter on the action and do the conversion later ? Il giorno 11/lug/07, alle ore 18:37, Martin Simons ha scritto: Hi everybody, this is my first mailing list :-) I'm currently developing a web-app based on Struts 2. My visitors are mainly German and whenever they enter numbers, they usually type a decimal number like 1,23 instead of 1.23. If the setter of the action requires a double, type conversion will fail and ask for an input result. For historic reasons this doesn't exist in my application. Input errors are handled separately and if type conversion fails, null or 0 is expected. How can I get Struts to use this behaviour, or even better, cast a comma- separated decimal to a double correctly. Thanks for your help, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do we get access to the servlet context from a class that is not an action?
You can use ServletActionContext.getServletContext() Il giorno 10/lug/07, alle ore 13:19, Asaf Paris Mandoki ha scritto: Hi, I have an action class (A) that uses another class (B). Is there a way to get access to the servlet context inside B without injecing it through A? Thanks in advance Asaf - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Form Processing - Security - ParameterNameAware
Hi, I think you can only have problems with parameter names that has public getter/setter in you action class. Il giorno 09/lug/07, alle ore 22:09, Gunnar Hillert ha scritto: Hi, Bump...Nobody using the ParameterNameAware interface? Any responses would be highly appreciated. Thanks! Gunnar Gunnar Hillert wrote: Hi, I have a question regarding the ParametersInterceptor, specifically the ParameterNameAware interface. Since Struts 2 is typically injecting the form parameters into the action, I have some security concerns. It works really great but I fear that malicious users could somehow inject other parameters as well. Therefore, during my current project (Actually my first Struts 2 project), I made all actions implement the ParameterNameAware interface. Then in the acceptableParameterName method, I specified the permissible parameters for the action. This really works nicely but here is my question: Is it generally a best practice to ALWAYS implement that interface when processing forms? (Or am I just too paranoid?) What is the general consensus on this issue? (I could not find too much information on this…) Lastly, instead of using the interface, would it be a good idea to have a dedicated annotation for this? Thanks! Regards, Gunnar Hillert -- View this message in context: http://www.nabble.com/-S2--Form- Processing---Security---ParameterNameAware-tf3944023.html#a11509072 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ot] weird message
Yes, I think it's a non-existent email that's subscribed... Il giorno 06/lug/07, alle ore 11:30, Jorge Martín Cuervo ha scritto: Hi all, every time i've sent an email to this list i receive another email like that: The original message was received at Fri, 6 Jul 2007 11:19:25 +0200 (CEST) from [EMAIL PROTECTED] - The following addresses had permanent fatal errors - [EMAIL PROTECTED] (reason: 550 5.0.0 [EMAIL PROTECTED]... User unknown) (expanded from: [EMAIL PROTECTED]) - Transcript of session follows - ... while talking to [127.0.0.1]: DATA 550 5.0.0 [EMAIL PROTECTED]... User unknown 550 5.1.1 [EMAIL PROTECTED] User unknown 503 5.0.0 Need RCPT (recipient) does any of you receive this email too? -- Jorge Martin Cuervo Analista Programador Outsourcing Emarketplace deFacto Powered by Standards email [EMAIL PROTECTED] voz +34 985 129 820 voz +34 660 026 384 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Found Denial Of Service (was [S2] App produces lot garbage IMPORTANT NEWS (I HOPE))
If the password field is named password and the password entered value is %{password} than this loop is eating all memory... Don't think it's this to cause my problem BUT it's a potentially BIG DOS problem !!! It work with every s:field I tried... Il giorno 05/lug/07, alle ore 01:53, Ing. Andrea Vettori ha scritto: All the traces points me to this function on the xwork library Since it contains an infinte loop it's promising ;) Need to sleep now, I hope tomorrow to find someone else solution in my inbox :) Thank you public static Object translateVariables(char open, String expression, ValueStack stack, Class asType, ParsedValueEvaluator evaluator) { // deal with the pure expressions first! //expression = expression.trim(); Object result = expression; while (true) { int start = expression.indexOf(open + {); int length = expression.length(); int x = start + 2; int end; char c; int count = 1; while (start != -1 x length count != 0) { c = expression.charAt(x++); if (c == '{') { count++; } else if (c == '}') { count--; } } end = x - 1; if ((start != -1) (end != -1) (count == 0)) { String var = expression.substring(start + 2, end); Object o = stack.findValue(var, asType); if (evaluator != null) { o = evaluator.evaluate(o); } String left = expression.substring(0, start); String right = expression.substring(end + 1); if (o != null) { if (TextUtils.stringSet(left)) { result = left + o; } else { result = o; } if (TextUtils.stringSet(right)) { result = result + right; } expression = left + o + right; } else { // the variable doesn't exist, so don't display anything result = left + right; expression = left + right; } } else { break; } } return XWorkConverter.getInstance().convertValue (stack.getContext(), result, asType); } -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Found Denial Of Service (was [S2] App produces lot garbage IMPORTANT NEWS (I HOPE))
Done. https://issues.apache.org/struts/browse/WW-2030 I tried on two different struts application. Maybe others can try on their app ??? If it's not already addressed it's a very serious bug! Il giorno 05/lug/07, alle ore 12:28, Antonio Petrelli ha scritto: 2007/7/5, Ing. Andrea Vettori [EMAIL PROTECTED]: If the password field is named password and the password entered value is %{password} than this loop is eating all memory... Don't think it's this to cause my problem BUT it's a potentially BIG DOS problem !!! It work with every s:field I tried... Why don't you open a JIRA issue, attaching a sample application code that demonstrates the problem? If it's an XWork problem, then it will be verified and a new issue will be opened for XWork team by a Struts developer. Antonio -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Found Denial Of Service (was [S2] App produces lot garbage IMPORTANT NEWS (I HOPE))
Hi, the cpu usage is by the garbage collector that's collecting a large amount of garbage !! Il giorno 05/lug/07, alle ore 13:01, Alexis Pigeon ha scritto: I confirm the issue. Just try this on an existing S2 application : - add the field s:password name=password/ - add the proper getter and setter in the Action class - launch the app - in the added field, write %{password} - in my case, the tomcat process is eating 100% of the cpu. no problem with memory consumption, though. Comments : - password can be replaced by any other string. - works with s:textfield tag too My config: Struts 2.0.8 Xwork 2.0.3 Tomcat 5.5.17 Java 1.5 I'm not familiar enough with JIRA to file an issue right now, but I'll do so later today if I find some time... On 05/07/07, Ing. Andrea Vettori [EMAIL PROTECTED] wrote: Done. https://issues.apache.org/struts/browse/WW-2030 I tried on two different struts application. Maybe others can try on their app ??? If it's not already addressed it's a very serious bug! Il giorno 05/lug/07, alle ore 12:28, Antonio Petrelli ha scritto: 2007/7/5, Ing. Andrea Vettori [EMAIL PROTECTED]: If the password field is named password and the password entered value is %{password} than this loop is eating all memory... Don't think it's this to cause my problem BUT it's a potentially BIG DOS problem !!! It work with every s:field I tried... Why don't you open a JIRA issue, attaching a sample application code that demonstrates the problem? If it's an XWork problem, then it will be verified and a new issue will be opened for XWork team by a Struts developer. Antonio -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] App produces lot garbage IMPORTANT NEWS (I HOPE)
/ASTProperty.getValueBody(ASTProperty.java:92)[optimized] at ognl/SimpleNode.evaluateGetValueBody(SimpleNode.java:170) [optimized] at ognl/SimpleNode.getValue(SimpleNode.java:210)[optimized] at ognl/Ognl.getValue(Ognl.java:333)[inlined] at com/opensymphony/xwork2/util/OgnlUtil.getValue(OgnlUtil.java: 194)[inlined] at com/opensymphony/xwork2/util/OgnlValueStack.findValue (OgnlValueStack.java:238)[optimized] at com/opensymphony/xwork2/util/TextParseUtil.translateVariables (TextParseUtil.java:122) at com/opensymphony/xwork2/util/TextParseUtil.translateVariables (TextParseUtil.java:71) at org/apache/struts2/components/Component.findValue (Component.java:313) at org/apache/struts2/components/UIBean.evaluateParams (UIBean.java:723) at org/apache/struts2/components/UIBean.end(UIBean.java:481) at org/apache/struts2/views/jsp/ComponentTagSupport.doEndTag (ComponentTagSupport.java:43) at org/apache/jsp/carrelloB_jsp._jspx_meth_s_005fpassword_005f0 (carrelloB_jsp.java:694) at org/apache/jsp/carrelloB_jsp._jspx_meth_s_005fform_005f2 (carrelloB_jsp.java:634) at org/apache/jsp/carrelloB_jsp._jspService(carrelloB_jsp.java:133) http-10.1.2.8-8080-1 id=85 idx=0x148 tid=12294 prio=5 alive, daemon at com/opensymphony/xwork2/util/TextParseUtil.translateVariables (TextParseUtil.java:109) at com/opensymphony/xwork2/util/TextParseUtil.translateVariables (TextParseUtil.java:71) at org/apache/struts2/components/Component.findValue (Component.java:313) at org/apache/struts2/components/UIBean.evaluateParams (UIBean.java:723) at org/apache/struts2/components/UIBean.end(UIBean.java:481) at org/apache/struts2/views/jsp/ComponentTagSupport.doEndTag (ComponentTagSupport.java:43) at org/apache/jsp/carrelloB_jsp._jspx_meth_s_005fpassword_005f0 (carrelloB_jsp.java:694) at org/apache/jsp/carrelloB_jsp._jspx_meth_s_005fform_005f2 (carrelloB_jsp.java:634) at org/apache/jsp/carrelloB_jsp._jspService(carrelloB_jsp.java:133) http-10.1.2.8-8080-1 id=85 idx=0x148 tid=12294 prio=5 alive, daemon at ognl/ASTProperty.getValueBody(ASTProperty.java:92)[optimized] at ognl/SimpleNode.evaluateGetValueBody(SimpleNode.java:170) [optimized] at ognl/SimpleNode.getValue(SimpleNode.java:210)[optimized] at ognl/Ognl.getValue(Ognl.java:333)[inlined] at com/opensymphony/xwork2/util/OgnlUtil.getValue(OgnlUtil.java: 194)[inlined] at com/opensymphony/xwork2/util/OgnlValueStack.findValue (OgnlValueStack.java:238)[optimized] at com/opensymphony/xwork2/util/TextParseUtil.translateVariables (TextParseUtil.java:122) at com/opensymphony/xwork2/util/TextParseUtil.translateVariables (TextParseUtil.java:71) at org/apache/struts2/components/Component.findValue (Component.java:313) at org/apache/struts2/components/UIBean.evaluateParams (UIBean.java:723) at org/apache/struts2/components/UIBean.end(UIBean.java:481) at org/apache/struts2/views/jsp/ComponentTagSupport.doEndTag (ComponentTagSupport.java:43) at org/apache/jsp/carrelloB_jsp._jspx_meth_s_005fpassword_005f0 (carrelloB_jsp.java:694) at org/apache/jsp/carrelloB_jsp._jspx_meth_s_005fform_005f2 (carrelloB_jsp.java:634) at org/apache/jsp/carrelloB_jsp._jspService(carrelloB_jsp.java:133) -- Ing. Andrea Vettori Responsabile Sistemi Informativi -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App produces lot garbage IMPORTANT NEWS (I HOPE)
All the traces points me to this function on the xwork library Since it contains an infinte loop it's promising ;) Need to sleep now, I hope tomorrow to find someone else solution in my inbox :) Thank you public static Object translateVariables(char open, String expression, ValueStack stack, Class asType, ParsedValueEvaluator evaluator) { // deal with the pure expressions first! //expression = expression.trim(); Object result = expression; while (true) { int start = expression.indexOf(open + {); int length = expression.length(); int x = start + 2; int end; char c; int count = 1; while (start != -1 x length count != 0) { c = expression.charAt(x++); if (c == '{') { count++; } else if (c == '}') { count--; } } end = x - 1; if ((start != -1) (end != -1) (count == 0)) { String var = expression.substring(start + 2, end); Object o = stack.findValue(var, asType); if (evaluator != null) { o = evaluator.evaluate(o); } String left = expression.substring(0, start); String right = expression.substring(end + 1); if (o != null) { if (TextUtils.stringSet(left)) { result = left + o; } else { result = o; } if (TextUtils.stringSet(right)) { result = result + right; } expression = left + o + right; } else { // the variable doesn't exist, so don't display anything result = left + right; expression = left + right; } } else { break; } } return XWorkConverter.getInstance().convertValue (stack.getContext(), result, asType); } -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage! SOLVED
As the last try to solve the problem I upgraded jboss to 4.2.0GA. This upgraded hibernate also. Solved. It seems that there was something in jboss and/or hibernate that produced the garbage forever... However, my code still benefit a lot from disabling logging of struts classes in jboss and caching the freemarker BeanWrapper. Hope to see this in the PerformanceTuning wiki pages. If I found WHAT's wrong with the previous version I'll make a note here. Thanks to all who have tried to help. Il giorno 25/giu/07, alle ore 18:40, Ing. Andrea Vettori ha scritto: I'll now try to profile the production server for a longer time and keep you informed. Unfortunately the garbage is still produced. But I can't profile the production server because the profiler crashes! Can anyone suggest a product to get the complete allocation object list ? Maybe in the meantime the yourkit guys resolve the problem but I really want to leave this problem behind as soon as possibile! Thank you -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage! SOLVED
Il giorno 30/giu/07, alle ore 13:54, Dave Newton ha scritto: --- Ing. Andrea Vettori wrote: However, my code still benefit a lot from disabling logging of struts \classes in jboss and caching the freemarker BeanWrapper. Hope to see this in the PerformanceTuning wiki pages. Logging and template caching, at least, are already on the tuning page. yes, logging is cited but a couple more lines on how to disable it on log4j will be helpful to many. And I don't mean template caching but BeanWrapper model caching that's not enabled by default and moreover it does not exist a struct option to enable (jira already opened). -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Thanks In fact they are already there! I made a mistake writing the email... Il giorno 27/giu/07, alle ore 22:05, Guillaume Carré ha scritto: 2007/6/23, Ing. Andrea Vettori [EMAIL PROTECTED]: yes the templates are into WEB-INFO/templates you have to put them in tour WEB-APP root, meaning the directory directly above WEB-INF Freemarker won't find the templates in your WEB-INF directory, meaning freemarker won't cache them you might get a performance boost and less generated garbage by putting the templates in the right directory... -- Guillaume Carré - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
It's because the complete link ends with trace1.html The email program truncated the link into two lines... Thank you! Il giorno 25/giu/07, alle ore 09:42, Al Sutton ha scritto: Just went to look at the full trace and got a; Forbidden You don't have permission to access /trace/ on this server. -Original Message- From: Ing. Andrea Vettori [mailto:[EMAIL PROTECTED] Sent: 25 June 2007 08:34 To: Struts Users Mailing List Subject: Re: [S2] App generate lot (2GB) of garbage! Hi, I've run a profile with yourkit (nice!) on my development platform. Here is the most important evidence. I've opened three product listings and a couple of product sheet in my site. Total garbage collected : 234 MB. Of these 234 MB, 64 are produced by org.jboss.remoting.transport.socket.ServerThread.run() so they are related to communication between the business layer and the presentation layer. Most of the other (156MB) are produced by com.opensymphony.xwork2.DefaultActionInvocation.invoke() so it's something related to struts. Going down the stack trace through interceptors the last class is org.apache.struts2.dispatcher.StrutsResultSupport.execute (ActionInvocation) that has 146MB of generated garbage. Now the interesting part : These 146MB are divided into : 34MB generated by freemarker.template.Template.process(Object, Writer) 22MB generated by com.opensymphony.xwork2.util.OgnlValueStack.findValue(String) 10MB generated by org.eclipse.jdt.internal.compiler.Compiler.compile (ICompilationUnit[]) 7MB generated by freemarker.template.Configuration.getTemplate(String) 6MB generated by org.eclipse.jdt.internal.compiler.Compiler.init (INameEnvironment, IErrorHandlingPolicy, Map, ICompilerRequestor, IProblemFactory, boolean) and a few other with less then 3MB each. You can find the complete trace on http://www.andreavettori.com/trace/ trace1.html. Do they seems normal numbers ??? I also don't understand if the difference between 146 and about 90 (=34+22+10+7+6+other small) is produced by org.apache.struts2.dispatcher.StrutsResultSupport.execute (ActionInvocation). That's over 50MB! Now if someone think that this can help solve my problem and understand where is produced this garbage I can run the same profile on the production server, maybe for a couple of minutes. I'm also really interested into knowing if you guys have ever checked gc collections on your applications... I don't think I'm the only one that writes garbage producer applications :). Thank you and please don't leave me alone with this problem! -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Hi, I've run a profile with yourkit (nice!) on my development platform. Here is the most important evidence. I've opened three product listings and a couple of product sheet in my site. Total garbage collected : 234 MB. Of these 234 MB, 64 are produced by org.jboss.remoting.transport.socket.ServerThread.run() so they are related to communication between the business layer and the presentation layer. Most of the other (156MB) are produced by com.opensymphony.xwork2.DefaultActionInvocation.invoke() so it's something related to struts. Going down the stack trace through interceptors the last class is org.apache.struts2.dispatcher.StrutsResultSupport.execute (ActionInvocation) that has 146MB of generated garbage. Now the interesting part : These 146MB are divided into : 34MB generated by freemarker.template.Template.process(Object, Writer) 22MB generated by com.opensymphony.xwork2.util.OgnlValueStack.findValue(String) 10MB generated by org.eclipse.jdt.internal.compiler.Compiler.compile (ICompilationUnit[]) 7MB generated by freemarker.template.Configuration.getTemplate(String) 6MB generated by org.eclipse.jdt.internal.compiler.Compiler.init (INameEnvironment, IErrorHandlingPolicy, Map, ICompilerRequestor, IProblemFactory, boolean) and a few other with less then 3MB each. You can find the complete trace on http://www.andreavettori.com/trace/ trace1.html. Do they seems normal numbers ??? I also don't understand if the difference between 146 and about 90 (=34+22+10+7+6+other small) is produced by org.apache.struts2.dispatcher.StrutsResultSupport.execute (ActionInvocation). That's over 50MB! Now if someone think that this can help solve my problem and understand where is produced this garbage I can run the same profile on the production server, maybe for a couple of minutes. I'm also really interested into knowing if you guys have ever checked gc collections on your applications... I don't think I'm the only one that writes garbage producer applications :). Thank you and please don't leave me alone with this problem! -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Il giorno 25/giu/07, alle ore 11:21, Al Sutton ha scritto: First thing I'd suggest; Turn off debug mode! It seems a chunk of the Gced objects are coming from preparing strings for log statements which are only activated when debug mode is on (for example; Com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValu e(Map, Object, Object) accounts for 5% of Gced objects, of which nearly the entire 5% comes from StringBuilter and Log4JLoggerdebug which are only used when debug mode is on). How ??? devMode is already false in struts.xml I've noticed that's a lot of log4j calls but don't know if they can be removed! Thanks Secondly it does seem as though there's anything wildly wrong here, there aren't any single methods which have large Gced object counts indicating there isn't a big bottleneck (yes, some show 30+%, but that's fairly evenly divided between the methods called by the 30+% method), which leads me to one question, how much data are you trying to output? Can you do a Save Source and tell me the size of the HTML file generated?, can you also provide the call tree with a call count so we can see how many times the methods are being executed? Thanks, Al. -Original Message- From: Ing. Andrea Vettori [mailto:[EMAIL PROTECTED] Sent: 25 June 2007 09:35 To: Struts Users Mailing List Subject: Re: [S2] App generate lot (2GB) of garbage! Il giorno 25/giu/07, alle ore 09:50, Al Sutton ha scritto: Your trace is at too higher level. Can you put a fully expanded copy of your trace that goes down to the leaf methods. Done. It's on traceall.html. I expanded only the two most garbage producing top call. Thank you -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Il giorno 25/giu/07, alle ore 09:50, Al Sutton ha scritto: Your trace is at too higher level. Can you put a fully expanded copy of your trace that goes down to the leaf methods. Done. It's on traceall.html. I expanded only the two most garbage producing top call. Thank you -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Ok I changed the jboss configuration. I think it would be helpful to put an advice on the performance page of struts. If using jboss you should limit the debug string production with category name=com.opensymphony priority value=INFO/ /category category name=ognl priority value=INFO/ /category category name=freemarker priority value=INFO/ /category on log4j.xml org.apache is already present in the default configuration. I'll now try to profile the production server for a longer time and keep you informed. Thank you Il giorno 25/giu/07, alle ore 12:06, Al Sutton ha scritto: The relevant piece of code is; if (LOG.isDebugEnabled()) { LOG.debug(Entering nullPropertyValue [target=+target+, property=+property+]); } So the check is always present, but if the check is true (i.e. debug is on) it also has to build the log message from the components in the debug call (i.e. create Entering nullPropertyValue [target=, then add the variable target, then add the string , property=, then add the variable property, then add the character ]), which is what the StringBuilder is doing. If the check is false, the call is not made, and the string doesn't need to be built, and hence no StringBuilder will be created, hence you'll see a drop of over 5% in your Gced object count for exactly the same test. -Original Message- From: Ing. Andrea Vettori [mailto:[EMAIL PROTECTED] Sent: 25 June 2007 10:36 To: Al Sutton Subject: Re: [S2] App generate lot (2GB) of garbage! I'm using jboss... I'll try to find the configuration. Just curious : so in the source code the production of that strings are on a condition that check the log4j configuration ? This mean that the overhead of checking the condition is always present ? Il giorno 25/giu/07, alle ore 11:33, Al Sutton ha scritto: Are you using log4j in your app or your appserver (e.g. Jetty uses it)? If so look for a log4j.properties file which turns debug mode on with a line similar to; log4j.rootLogger=DEBUG -Original Message- From: Ing. Andrea Vettori [mailto:[EMAIL PROTECTED] Sent: 25 June 2007 10:28 To: Struts Users Mailing List; Al Sutton Subject: Re: [S2] App generate lot (2GB) of garbage! Il giorno 25/giu/07, alle ore 11:21, Al Sutton ha scritto: First thing I'd suggest; Turn off debug mode! It seems a chunk of the Gced objects are coming from preparing strings for log statements which are only activated when debug mode is on (for example; Com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyVa l u e(Map, Object, Object) accounts for 5% of Gced objects, of which nearly the entire 5% comes from StringBuilter and Log4JLoggerdebug which are only used when debug mode is on). How ??? devMode is already false in struts.xml I've noticed that's a lot of log4j calls but don't know if they can be removed! Thanks Secondly it does seem as though there's anything wildly wrong here, there aren't any single methods which have large Gced object counts indicating there isn't a big bottleneck (yes, some show 30+%, but that's fairly evenly divided between the methods called by the 30+% method), which leads me to one question, how much data are you trying to output? Can you do a Save Source and tell me the size of the HTML file generated?, can you also provide the call tree with a call count so we can see how many times the methods are being executed? Thanks, Al. -Original Message- From: Ing. Andrea Vettori [mailto:[EMAIL PROTECTED] Sent: 25 June 2007 09:35 To: Struts Users Mailing List Subject: Re: [S2] App generate lot (2GB) of garbage! Il giorno 25/giu/07, alle ore 09:50, Al Sutton ha scritto: Your trace is at too higher level. Can you put a fully expanded copy of your trace that goes down to the leaf methods. Done. It's on traceall.html. I expanded only the two most garbage producing top call. Thank you -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology -- Ing. Andrea Vettori Consulente per l'Information Technology -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
I'll now try to profile the production server for a longer time and keep you informed. Unfortunately the garbage is still produced. But I can't profile the production server because the profiler crashes! Can anyone suggest a product to get the complete allocation object list ? Maybe in the meantime the yourkit guys resolve the problem but I really want to leave this problem behind as soon as possibile! Thank you -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
There are three pages of issues on freemarker... I'll take a look at them and see if it's already present. Thank you Il giorno 22/giu/07, alle ore 19:17, Antonio Petrelli ha scritto: Andrea, please create a JIRA issue for this, and join the discussion at the Struts Developers list too, if possible: http://www.nabble.com/-S2--FreeMarker-usage-in-Struts-2-tf3965756.html Antonio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Il giorno 22/giu/07, alle ore 19:20, Musachy Barroso ha scritto: Yes, freemarker is used by Struts 2 tags to generate html. We could have a property for the cache setting, but, does it solve your problem? (you said it was partially resolved) Most of the garbage is still there but at least about 400-500 MB generated from freemarker classes seems not there anymore. I tried to use jrockit instead of sun jvm since it has a better memory analyzer but I haven't been able to produce a report yet. May I ask more on how struts2 is using freemarker ? How is freemarker used in a code snippet like this : td width=34% valign=bottom class=fontNormale align=center span s:form name=RicercaArticoliVisOrdina action=RicercaArticoliVis Ordina per s:select list=% {listaOrdinamentoArticoli} value=${numeri.ordinamento[0]} name=ordinamento onchange=document.RicercaArticoliVisOrdina.submit ()/ s:hidden name=idRicerca value=$ {numeri.idRicerca}/ /s:form /span /td td width=33% valign=bottom class=fontNormale align=right span s:form name=RicercaArticoliVisDimPagina action=RicercaArticoliVis Mostra s:select list={5, 10, 20, 30} value=${numeri.dimPagina} name=dimPagina onchange=document.RicercaArticoliVisDimPagina.submit()/ prodotti per pagina s:hidden name=idRicerca value=$ {numeri.idRicerca}/ /s:form /span /td What object are created ? Thanks regards musachy On 6/20/07, Ing. Andrea Vettori [EMAIL PROTECTED] wrote: I discussed the problem with the freemarker team and I used a suggestion that PARTIALLY resolved. They said : = You can use the code below to enable the model cache, assuming myConfiguration is the reference to your Configuration object: ((BeansWrapper)myConfiguration.getObjectWrapper()).setUseCache(true) and see if it helps you with your GC load levels. = This actually seems to happen. In struts how can this be done ? I used : freemarker.template.Configuration fmc = (freemarker.template.Configuration) ServletActionContext.getServletContext().getAttribute (FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY); if (fmc != null) { ((freemarker.ext.beans.BeansWrapper)fmc.getObjectWrapper ()).setUseCache(true); } but I think there must be a configuration somewhere (struts.properties?). To completely solve my problem I really need to understand the following : How struts uses freemarker ? If i have a jsp page that contains html, jsp tags, struts tags and jsp EL expression, where freemarker is used ? I suppose that it's used ONLY on struts tags... So if my page is composed primarly of jsp EL and jsp tags and a few struts tags can I focus on struts tags only to try to understand why the app is producing garbage ? Thank you Il giorno 19/giu/07, alle ore 12:58, Ing. Andrea Vettori ha scritto: Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto: 2007/6/19, Ing. Andrea Vettori [EMAIL PROTECTED]: Moreover I'm not using freemaker in my project! It's struts that's using it. My page are all jsps !! This is pretty strange... Is FreeMarker servlet declared in your web.xml? No it's not. I think that freemarker classes are used by struts internally for the themes... I use the simple theme. I really can't understand what's producing near 2GB of garbage every 10 seconds! -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Il giorno 23/giu/07, alle ore 09:19, Musachy Barroso ha scritto: Struts 2 uses freemarker to generate the html for the tags, for example for the form tag this template is used: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/ resources/template/simple/form.ftl?view=markup So struts asks freemarker to generate the html for the struts tag. Freemarker looks at the template and outputs the html based on it. Freemarker is caching the template in memory to not have to read them from the disk every time. Looks similar to what jsp compiler do with the difference that jsp tags have hard-coded html and freemarker has template based html. Am I right ? But what's the various BeanWrappers doing in the previous process ? It's about the passing of parameters from the struts tag to FreeMarker ? It's the BeanWrappers that was consuming a lot of memory before I enabled caching of them. I was playing with jrockit also and trying to replicate the problem, but it is kind of hard :). Do you have any testcase, or a page, something that could help us replicate the problem? The jrcmd command that's used to profiling is not working on my server :( I posted a question on the bea forum This problem is a hell !!! :) I don't think I can produce a testcase but I try to tell how is the application organized (btw you can view the site on www.elettrotop.com but don't think this can help to solve the problem...). I have a MaxDB (formerly SAPDB) database that's accessed ONLY through EJB3 session beans / entity beans. I'm using JBoss 4.0.5-GA which uses Hibernate 3. The view is composed of struts2 actions, a few servlets producing PDFs and images and jsp pages. All the view logic is inside struts2 actions and they access the database using RMI call to stateless and stateful session beans. Now it's all inside the same server but this architecture gives me the option to separate the web interface (with the option to have more than one web server) from the business logic (maybe on another server) and the database (maybe on another server). I've implemented a lot of caching of (mostly read-only) database data in the struts actions but the profiler says that less than 100MB are used by my classes. Also the cache lasts at least a Session life so it can't be part of the 2GB that's collected since this happens every 10 seconds or less (using sun jvm). I've checked I don't have _unfortunately_ a lot sessions that dies every 10 seconds :) Most used page of the site is the product listings where the user can browse an in ram list of dataobjects created with an ejb3 query in a session bean. The entire list is returned and cached for struts2 action as said above. When I first profiled the app, the most ram demanding classes was freemarker.ext.beans. generated HashMaps (between 400 and 500 mb). -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
yes the templates are into WEB-INFO/templates Il giorno 23/giu/07, alle ore 11:28, Guillaume Carré ha scritto: 2007/6/23, Ing. Andrea Vettori [EMAIL PROTECTED]: So struts asks freemarker to generate the html for the struts tag. Freemarker looks at the template and outputs the html based on it. Freemarker is caching the template in memory to not have to read them from the disk every time. freemarker caches the templates only if there are in the WEB_APP root, have you copied the /template directory from the struts2 jar there? see: http://struts.apache.org/2.x/docs/performance-tuning.html -- Guillaume Carré - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
I discussed the problem with the freemarker team and I used a suggestion that PARTIALLY resolved. They said : = You can use the code below to enable the model cache, assuming myConfiguration is the reference to your Configuration object: ((BeansWrapper)myConfiguration.getObjectWrapper()).setUseCache(true) and see if it helps you with your GC load levels. = This actually seems to happen. In struts how can this be done ? I used : freemarker.template.Configuration fmc = (freemarker.template.Configuration) ServletActionContext.getServletContext().getAttribute (FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY); if (fmc != null) { ((freemarker.ext.beans.BeansWrapper)fmc.getObjectWrapper ()).setUseCache(true); } but I think there must be a configuration somewhere (struts.properties?). To completely solve my problem I really need to understand the following : How struts uses freemarker ? If i have a jsp page that contains html, jsp tags, struts tags and jsp EL expression, where freemarker is used ? I suppose that it's used ONLY on struts tags... So if my page is composed primarly of jsp EL and jsp tags and a few struts tags can I focus on struts tags only to try to understand why the app is producing garbage ? Thank you Il giorno 19/giu/07, alle ore 12:58, Ing. Andrea Vettori ha scritto: Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto: 2007/6/19, Ing. Andrea Vettori [EMAIL PROTECTED]: Moreover I'm not using freemaker in my project! It's struts that's using it. My page are all jsps !! This is pretty strange... Is FreeMarker servlet declared in your web.xml? No it's not. I think that freemarker classes are used by struts internally for the themes... I use the simple theme. I really can't understand what's producing near 2GB of garbage every 10 seconds! -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Anyone ? Anyone knows who's calling freemarker.ext.beans methods ? Il giorno 17/giu/07, alle ore 19:08, Ing. Andrea Vettori ha scritto: Hi, I've a struts 2.0.8 app that runs on Linux and JBoss 4.0.5. I'ts an e-commerce site. I have the following problem. The app seems to generate lot of garbage in RAM (young gen) that the gc correctly collects. But when there is more than a few users on the site, that amount of garbage is generated about every 10 seconds or less depending on the number of users. This cause a lot of cpu usage... Tracking the memory usage with the hprof agent I found that a lot of memory is used by freemarker.* classes on HashMaps. I have devMode turned off, have the template dir on the root of the war file and I have the freemarker.properties file into the classes dir inside WEB-INF with template_update_delay=6. Any hint on WHY the application is generating such big amount of garbage ? Thank you Here is top memory usage and relative traces : bytes 192,090,608 obj number: 1,263,754 class: java.util.HashMap$Entry[] TRACE 352396: java.util.HashMap.init(HashMap.java:203) freemarker.ext.beans.BeanModel.init(BeanModel.java:117) freemarker.ext.beans.StringModel.init(StringModel.java:90) freemarker.ext.beans.StringModel$1.create(StringModel.java:75) bytes: 143,560,048 obj number: 944,474 class: java.util.HashMap$Entry[] TRACE 352387: java.util.HashMap.init(HashMap.java:203) freemarker.ext.beans.BeanModel.init(BeanModel.java:117) freemarker.ext.beans.StringModel.init(StringModel.java:90) freemarker.ext.beans.MapModel.init(MapModel.java:105) bytes: 141,327,104 obj number: 2,208,236 class: java.util.HashMap TRACE 352386: java.util.AbstractMap.init(AbstractMap.java:53) java.util.HashMap.init(HashMap.java:200) freemarker.ext.beans.BeanModel.init(BeanModel.java:117) freemarker.ext.beans.StringModel.init(StringModel.java:90) -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
yes but their list and forum seems almost dead... I hope someone in the struts team can help me found what's the problem... Il giorno 19/giu/07, alle ore 11:39, Antonio Petrelli ha scritto: 2007/6/19, Ing. Andrea Vettori [EMAIL PROTECTED]: Anyone knows who's calling freemarker.ext.beans methods ? Did you try asking the FreeMarker team? Antonio -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Moreover I'm not using freemaker in my project! It's struts that's using it. My page are all jsps !! Il giorno 19/giu/07, alle ore 11:41, Ing. Andrea Vettori ha scritto: yes but their list and forum seems almost dead... I hope someone in the struts team can help me found what's the problem... Il giorno 19/giu/07, alle ore 11:39, Antonio Petrelli ha scritto: 2007/6/19, Ing. Andrea Vettori [EMAIL PROTECTED]: Anyone knows who's calling freemarker.ext.beans methods ? Did you try asking the FreeMarker team? Antonio -- Ing. Andrea Vettori Consulente per l'Information Technology -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] App generate lot (2GB) of garbage!
Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto: 2007/6/19, Ing. Andrea Vettori [EMAIL PROTECTED]: Moreover I'm not using freemaker in my project! It's struts that's using it. My page are all jsps !! This is pretty strange... Is FreeMarker servlet declared in your web.xml? No it's not. I think that freemarker classes are used by struts internally for the themes... I use the simple theme. I really can't understand what's producing near 2GB of garbage every 10 seconds! -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] App generate lot (2GB) of garbage!
Hi, I've a struts 2.0.8 app that runs on Linux and JBoss 4.0.5. I'ts an e- commerce site. I have the following problem. The app seems to generate lot of garbage in RAM (young gen) that the gc correctly collects. But when there is more than a few users on the site, that amount of garbage is generated about every 10 seconds or less depending on the number of users. This cause a lot of cpu usage... Tracking the memory usage with the hprof agent I found that a lot of memory is used by freemarker.* classes on HashMaps. I have devMode turned off, have the template dir on the root of the war file and I have the freemarker.properties file into the classes dir inside WEB-INF with template_update_delay=6. Any hint on WHY the application is generating such big amount of garbage ? Thank you Here is top memory usage and relative traces : bytes 192,090,608 obj number: 1,263,754 class: java.util.HashMap$Entry[] TRACE 352396: java.util.HashMap.init(HashMap.java:203) freemarker.ext.beans.BeanModel.init(BeanModel.java:117) freemarker.ext.beans.StringModel.init(StringModel.java:90) freemarker.ext.beans.StringModel$1.create(StringModel.java:75) bytes: 143,560,048 obj number: 944,474 class: java.util.HashMap$Entry[] TRACE 352387: java.util.HashMap.init(HashMap.java:203) freemarker.ext.beans.BeanModel.init(BeanModel.java:117) freemarker.ext.beans.StringModel.init(StringModel.java:90) freemarker.ext.beans.MapModel.init(MapModel.java:105) bytes: 141,327,104 obj number: 2,208,236 class: java.util.HashMap TRACE 352386: java.util.AbstractMap.init(AbstractMap.java:53) java.util.HashMap.init(HashMap.java:200) freemarker.ext.beans.BeanModel.init(BeanModel.java:117) freemarker.ext.beans.StringModel.init(StringModel.java:90) -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
s2 image submit button and methods
Hi, yesterday it took me a day to understand and resolve a problem so I think it can be useful to share it; maybe someone can explain a better solution. I have a form with more than one submit button. The submit buttons are images so I used the s:submit type=image method= ... tag on all but the default button. The problem is that since the image button is considered by the browser similar to an imagemap, if the button is called btnA, the browser submits btnA, btnA.x and btnA.y request parameters, where the .x and .y are the coordinates of the click inside the image. I think this cannot be disabled on the browser since it is required by the HTML specifications. Now this cause problems when the parameters are used by the action to call the appropriate method. If I have a button like s:form action=anAction ... s:submit type=image method=aMethod ... in the HTML you get something like input type=image name=method:aMethod ... and when the request is submitted the browser sends method:aMethod, method:aMethod.x and method:aMethod.y parameters. This cause the framework to try to execute the aMethod.x() method on the action class which generate an Exception !!! I've tried to filter the parameters with ParameterNameAware but the parameter that starts with method: are not passed to the acceptableParameter method. So I extended the parameters interceptor and overrided the acceptableParameter function and even if now I see the parameters on the method, even if I reject them, the framework use them to try to execute the method in the action. The solution I used is to have the image submit to set a value (like s:submit type=image name=aName value=aValue and use that value inside the execute method of the action to call the appropriate method. But I'm looking for a better solution. I also think that since this will be a common problem, it should be addressed by the framework automatically rejecting method:xxx and action:xxx parameters that ends with a .x and .y. Thanks -- Ing. Andrea Vettori Consulente per l'Information Technology
Re: Struts2 question on action with properties
Ok I understand. What I'm missing is that when the form is displayed the Action is not yet istantiated so no methods can be called. If you want to call a method of that Action you must instantiate it with the action tag. Thanks Il giorno 10/nov/06, alle ore 00:15, Ted Husted ha scritto: The typical approach is to place an input method on the Action that is associated to the form. To display the method, you can refer to action_input and then to submit the action you can refer to just action. If you want to avoid defining two action elements, you can use wildcards. action name=action_* method={1} class=... -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts2 question on action with properties
Hi, I've used struts1 a lot and now I'm using struts2 version 2.0.1 for a new medium-sized project (it's an e-commerce site). I'm facing this problem and since the documentation is poor (or at least it seems poor, maybe I'm looking on the wrong places), I need an advice from you experts. In the home page, that is a jsp page loaded with the Home action, I have a couple of forms. In one of them I need to use a select tag to give the user some options. I've put the List getInfos() method on the Action specified on the form that contains the select tag since I thought that an Action would be instanciated and used to call the method. This gives me an error saying that the list param of the select tag is not found as a collection/array/. etc. Putting the getInfos() method on the Home action, that is the action that call the jsp page where the form is, works. Now I think it would be cleaner if the getInfos() method belonged to the Action that is associated to the form. Is this possible to do ? Am I missing something ? Thank you P.S. Hope you understand my Italian-English :) -- Ing. Andrea Vettori Consulente per l'Information Technology