jsr340-experts@servlet-spec.java.net

[jsr340-experts] Re: SERVLET_SPEC-23: Help prevent infinite loops

From: Mark Thomas <markt_at_apache.org>
Date: Tue, 03 Jan 2012 22:59:12 +0000

On 22/12/2011 02:15, Alex Rojkov wrote:
>>>>>> Hi,
>>>>>> I am looking at http://java.net/jira/browse/SERVLET_SPEC-23
>>>>>> I plan to throw IllegalArgumentException when an infinite loop is detected.
>>>>>> If you have any comment, then please let me know.
>>>>> There are already dubious checks required in the request dispatcher by
>>>>> the specification, which have a cost. I would like to avoid adding
>>>>> additional pointless checks.
>>>> +1
>>> Fair point. This is certainly adding overhead to try and attempt to
>>> prevent users shooting themselves in the foot.
>>>
>>> If we can get into the spec that IllegalArugmentException may (rather
>>> than must) be thrown at this point if invalid/silly input is provided,
>>> then we can leave it up to the containers to decide how much checking
>>> they want to provide in what circumstances.
>>>
>>> Mark
>> The check should not be complicated or too costly as each corresponding vertex has only one outgoing edge
>> and also in general there is not too many vertex in the corresponding graph.
>> But I understand the concern that it may introduce an overhead (no matter how small it is).
>> I prefer either check it or do not check it.
>
> I am concerned that the check would be adding cost while providing no value.
> Please correct me if my understanding is wrong.

The value is in aiding debugging. While the infinite loop is easy to
spot, finding the root cause can be much trickier.

That said, if folks don't want to see this in the spec, I'll just add an
option to Tomcat enable this check outside of the spec. No big deal.

Mark