You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Eric Blenkush <er...@commongrnd.com> on 2004/10/20 06:20:02 UTC

JSP Compile Hangs

Hi,

On Tomcat 5.5.2 I am experiencing very long compile times(and hangs)  
for certain JSP pages. The page has an EL expression like this:

${fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
toUpperCase(('b'))))))))))))))))))))))))))))))))))))}

If you remove the extraneous parenthesis it will compile and execute  
very quickly. However, if you add more nested calls to fn:toUpperCase  
compiling will again take a very long time. So, this may be related to  
the number of nested expressions. This is just a test case obviously  
but I am generating JSPs automatically and it is difficult if not  
impossible to avoid EL statements with these nested function calls.  
Resin can compile and execute these pages very quickly but I want to  
stick with Tomcat.

This is crucial to the project I am working on and if someone has an  
idea of what is causing this and where to look in the tomcat source I  
would appreciate it.

Thanks,
Eric Blenkush


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JSP Compile Hangs

Posted by Eric Blenkush <er...@commongrnd.com>.
Im glad to get confirmation on this. Why is it so bad that the problem 
is in commons-el?

Eric

On Oct 22, 2004, at 5:07 AM, Remy Maucherat wrote:

> Eric Blenkush wrote:
>
>> Certainly. I hope you mean post it to this list, I didnt see anywhere 
>>  on bugzilla to submit one. Here is the text of the JSP and the file.
>
> I can reproduce the issue, and it's obvious in the thread stack that 
> the issue is with the parser in commons-el :(
>
> Rémy
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JSP Compile Hangs

Posted by Remy Maucherat <re...@apache.org>.
Eric Blenkush wrote:

> Certainly. I hope you mean post it to this list, I didnt see anywhere  
> on bugzilla to submit one. Here is the text of the JSP and the file.

I can reproduce the issue, and it's obvious in the thread stack that the 
issue is with the parser in commons-el :(

Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JSP Compile Hangs

Posted by Eric Blenkush <er...@commongrnd.com>.
On Oct 21, 2004, at 10:17 AM, Remy Maucherat wrote:

> Eric Blenkush wrote:
>
>> Kin-man,
>>
>> Thanks for the response. I filed a bug report and I have an initial  
>> fix  that I have been working on. Here is a preview:
>>
>> This is due to the LOOKAHEAD on line 256 of ELParser.jj
>>
>> This fix allows the EL expression to be parsed quickly but I have not  
>>  tested thoroughly. In ELParser.jj delete the grammar production   
>> ConditionalExpression() and replace Expression() and OrExpression()   
>> with the below text:
>
> Thanks for the possible fix (getting it out is going to be a little  
> painful, though, as Kin-Man mentioned :( ), but can you send a test  
> JSP as well ?
>
> Rémy
>
>

Certainly. I hope you mean post it to this list, I didnt see anywhere  
on bugzilla to submit one. Here is the text of the JSP and the file.

Eric

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html><head><title></title></head><body>
${fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn: 
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn: 
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn: 
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn: 
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn: 
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn: 
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn: 
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn: 
toUpperCase('a'))))))))))))))))))))))))))))))))}
</body></html>



Re: JSP Compile Hangs

Posted by Remy Maucherat <re...@apache.org>.
Eric Blenkush wrote:

> Kin-man,
>
> Thanks for the response. I filed a bug report and I have an initial 
> fix  that I have been working on. Here is a preview:
>
> This is due to the LOOKAHEAD on line 256 of ELParser.jj
>
> This fix allows the EL expression to be parsed quickly but I have not  
> tested thoroughly. In ELParser.jj delete the grammar production  
> ConditionalExpression() and replace Expression() and OrExpression()  
> with the below text:

Thanks for the possible fix (getting it out is going to be a little 
painful, though, as Kin-Man mentioned :( ), but can you send a test JSP 
as well ?

Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JSP Compile Hangs

Posted by Eric Blenkush <er...@commongrnd.com>.
Kin-man,

Thanks for the response. I filed a bug report and I have an initial fix  
that I have been working on. Here is a preview:

This is due to the LOOKAHEAD on line 256 of ELParser.jj

This fix allows the EL expression to be parsed quickly but I have not  
tested thoroughly. In ELParser.jj delete the grammar production  
ConditionalExpression() and replace Expression() and OrExpression()  
with the below text:

Expression Expression () :
{
   Expression ret;
}
{
   (
    ret = OrExpression ()
   )
   { return ret; }
}


Expression OrExpression () :
{
   Expression startExpression, condition, trueBranch=null,  
falseBranch=null;
   BinaryOperator operator;
   Expression expression;
   List operators = null;
   List expressions = null;
}
{
   startExpression = AndExpression ()

     ((
      (
       (<OR1> | <OR2>) { operator = OrOperator.SINGLETON; }
       )
      expression = AndExpression ()

       {
	if (operators == null) {
	  operators = new ArrayList ();
	  expressions = new ArrayList ();
	}
	operators.add (operator);
	expressions.add (expression);
       }
      )*
      (
      <COND>
      trueBranch = Expression ()
      <COLON>
      falseBranch = Expression ()
      )?
     )
   {
     if (operators != null) {
       condition = new BinaryOperatorExpression (startExpression,
					   operators,
					   expressions);
     }
     else {
       condition = startExpression;
     }

     if(trueBranch != null)
         return new ConditionalExpression(condition, trueBranch,  
falseBranch);
     else
         return condition;
   }
}


On Oct 20, 2004, at 1:20 PM, Kin-man Chung wrote:

> Please file a report on bugzilla.  If you also include a test case
> (to save me some typing :)), I'll take a look to see where Jasper is
> spending its time.  Did you said it was in commons-el?  That'd be bad.
>
> -Kin-man
>
> On Wed, 2004-10-20 at 00:43, Eric Blenkush wrote:
>> On Oct 19, 2004, at 10:41 PM, Remy Maucherat wrote:
>>
>>> Eric Blenkush wrote:
>>>
>>>> Hi,
>>>>
>>>> On Tomcat 5.5.2 I am experiencing very long compile times(and hangs)
>>>> for certain JSP pages. The page has an EL expression like this:
>>>>
>>>> ${fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
>>>> toUpperCase((fn:
>>>> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:
>>>> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:
>>>> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:
>>>> toUpperCase(('b'))))))))))))))))))))))))))))))))))))}
>>>>
>>>> If you remove the extraneous parenthesis it will compile and execute
>>>> very quickly. However, if you add more nested calls to  
>>>> fn:toUpperCase
>>>>  compiling will again take a very long time. So, this may be related
>>>> to  the number of nested expressions. This is just a test case
>>>> obviously  but I am generating JSPs automatically and it is  
>>>> difficult
>>>> if not  impossible to avoid EL statements with these nested function
>>>> calls.  Resin can compile and execute these pages very quickly but I
>>>> want to  stick with Tomcat.
>>>>
>>>> This is crucial to the project I am working on and if someone has an
>>>> idea of what is causing this and where to look in the tomcat source  
>>>> I
>>>>  would appreciate it.
>>>
>>> Please don't whine. I hope you have tested this with 5.0.x as well.
>>>
>>> If you have a compilation problem specific to the Java compiler, you
>>> obviously should:
>>> - report it to the Eclipse project
>>> - use Ant + javac to compile instead (remove the
>>> jasper-compiler-jdt.jar and put ant.jar at the same spot)
>>>
>>> You may want to try to generate efficient code.
>>>
>>> Any bug filed about the Eclipse compiler (other than an integration
>>> issue) will be marked as INVALID.
>>>
>>> Rémy
>>>
>>
>> The hang is happening when the .java file is being generated from the
>> .jsp file. I confirmed this by taking the commons-el-1.0 source and
>> modifying it to parse the same EL statement as given above and it  
>> never
>> completed.
>>
>> Any helpful comments on where to start looking to fix this are  
>> welcome.
>>
>> Thanks,
>> Eric
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JSP Compile Hangs

Posted by Kin-man Chung <ki...@sun.com>.
Please file a report on bugzilla.  If you also include a test case
(to save me some typing :)), I'll take a look to see where Jasper is
spending its time.  Did you said it was in commons-el?  That'd be bad.

-Kin-man

On Wed, 2004-10-20 at 00:43, Eric Blenkush wrote:
> On Oct 19, 2004, at 10:41 PM, Remy Maucherat wrote:
> 
> > Eric Blenkush wrote:
> >
> >> Hi,
> >>
> >> On Tomcat 5.5.2 I am experiencing very long compile times(and hangs)  
> >> for certain JSP pages. The page has an EL expression like this:
> >>
> >> ${fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
> >> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
> >> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
> >> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
> >> toUpperCase(('b'))))))))))))))))))))))))))))))))))))}
> >>
> >> If you remove the extraneous parenthesis it will compile and execute  
> >> very quickly. However, if you add more nested calls to fn:toUpperCase 
> >>  compiling will again take a very long time. So, this may be related 
> >> to  the number of nested expressions. This is just a test case 
> >> obviously  but I am generating JSPs automatically and it is difficult 
> >> if not  impossible to avoid EL statements with these nested function 
> >> calls.  Resin can compile and execute these pages very quickly but I 
> >> want to  stick with Tomcat.
> >>
> >> This is crucial to the project I am working on and if someone has an  
> >> idea of what is causing this and where to look in the tomcat source I 
> >>  would appreciate it.
> >
> > Please don't whine. I hope you have tested this with 5.0.x as well.
> >
> > If you have a compilation problem specific to the Java compiler, you 
> > obviously should:
> > - report it to the Eclipse project
> > - use Ant + javac to compile instead (remove the 
> > jasper-compiler-jdt.jar and put ant.jar at the same spot)
> >
> > You may want to try to generate efficient code.
> >
> > Any bug filed about the Eclipse compiler (other than an integration 
> > issue) will be marked as INVALID.
> >
> > Rémy
> >
> 
> The hang is happening when the .java file is being generated from the 
> .jsp file. I confirmed this by taking the commons-el-1.0 source and 
> modifying it to parse the same EL statement as given above and it never 
> completed.
> 
> Any helpful comments on where to start looking to fix this are welcome.
> 
> Thanks,
> Eric
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JSP Compile Hangs

Posted by Remy Maucherat <re...@apache.org>.
Eric Blenkush wrote:

> The hang is happening when the .java file is being generated from the 
> .jsp file. I confirmed this by taking the commons-el-1.0 source and 
> modifying it to parse the same EL statement as given above and it 
> never completed.
>
> Any helpful comments on where to start looking to fix this are welcome.

Ah, ok, so it's not the Java compilation then, and it is the same with 
5.0.x ?

As for your question, you answered it I think ;)

Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JSP Compile Hangs

Posted by Eric Blenkush <er...@commongrnd.com>.
On Oct 19, 2004, at 10:41 PM, Remy Maucherat wrote:

> Eric Blenkush wrote:
>
>> Hi,
>>
>> On Tomcat 5.5.2 I am experiencing very long compile times(and hangs)  
>> for certain JSP pages. The page has an EL expression like this:
>>
>> ${fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
>> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
>> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
>> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
>> toUpperCase(('b'))))))))))))))))))))))))))))))))))))}
>>
>> If you remove the extraneous parenthesis it will compile and execute  
>> very quickly. However, if you add more nested calls to fn:toUpperCase 
>>  compiling will again take a very long time. So, this may be related 
>> to  the number of nested expressions. This is just a test case 
>> obviously  but I am generating JSPs automatically and it is difficult 
>> if not  impossible to avoid EL statements with these nested function 
>> calls.  Resin can compile and execute these pages very quickly but I 
>> want to  stick with Tomcat.
>>
>> This is crucial to the project I am working on and if someone has an  
>> idea of what is causing this and where to look in the tomcat source I 
>>  would appreciate it.
>
> Please don't whine. I hope you have tested this with 5.0.x as well.
>
> If you have a compilation problem specific to the Java compiler, you 
> obviously should:
> - report it to the Eclipse project
> - use Ant + javac to compile instead (remove the 
> jasper-compiler-jdt.jar and put ant.jar at the same spot)
>
> You may want to try to generate efficient code.
>
> Any bug filed about the Eclipse compiler (other than an integration 
> issue) will be marked as INVALID.
>
> Rémy
>

The hang is happening when the .java file is being generated from the 
.jsp file. I confirmed this by taking the commons-el-1.0 source and 
modifying it to parse the same EL statement as given above and it never 
completed.

Any helpful comments on where to start looking to fix this are welcome.

Thanks,
Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JSP Compile Hangs

Posted by Remy Maucherat <re...@apache.org>.
Eric Blenkush wrote:

> Hi,
>
> On Tomcat 5.5.2 I am experiencing very long compile times(and hangs)  
> for certain JSP pages. The page has an EL expression like this:
>
> ${fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
> toUpperCase((fn:toUpperCase((fn:toUpperCase((fn: 
> toUpperCase(('b'))))))))))))))))))))))))))))))))))))}
>
> If you remove the extraneous parenthesis it will compile and execute  
> very quickly. However, if you add more nested calls to fn:toUpperCase  
> compiling will again take a very long time. So, this may be related 
> to  the number of nested expressions. This is just a test case 
> obviously  but I am generating JSPs automatically and it is difficult 
> if not  impossible to avoid EL statements with these nested function 
> calls.  Resin can compile and execute these pages very quickly but I 
> want to  stick with Tomcat.
>
> This is crucial to the project I am working on and if someone has an  
> idea of what is causing this and where to look in the tomcat source I  
> would appreciate it.

Please don't whine. I hope you have tested this with 5.0.x as well.

If you have a compilation problem specific to the Java compiler, you 
obviously should:
- report it to the Eclipse project
- use Ant + javac to compile instead (remove the jasper-compiler-jdt.jar 
and put ant.jar at the same spot)

You may want to try to generate efficient code.

Any bug filed about the Eclipse compiler (other than an integration 
issue) will be marked as INVALID.

Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org