[ grinder-Bugs-3206627 ] Line endings under Apache

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.grinder.devel
Message-ID <[email protected]>
Bugs item #3206627, was opened at 2011-03-11 16:51
Message generated for change (Comment added) made by philipa
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=3206627&group_id=18598

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HTTP Plugin
Group: None
>Status: Closed
Resolution: Duplicate
Priority: 5
Private: No
Submitted By: Steven Swart (stevenswart)
Assigned to: Nobody/Anonymous (nobody)
Summary: Line endings under Apache

Initial Comment:
I recently ran into a problem while running a Grinder script against Apache. The same script was succeeding against IIS, but against Apache was  throwing the following exception:

2011/03/11 4:22:31 PM (thread 0 run 0 test 501): Aborted run due to
Java exception calling TestRunner
Java exception calling TestRunner
      File "C:\Testing\grinder\newuicreateprojectcreatetemplate1.py", line
152, in page5
      File "C:\Testing\grinder\newuicreateprojectcreatetemplate1.py", line
281, in __call__
Caused by: java.io.EOFException: Premature EOF encountered
      at HTTPClient.StreamDemultiplexor.read(StreamDemultiplexor.java:300)
      at HTTPClient.RespInputStream.read(RespInputStream.java:155)
      at HTTPClient.HTTPResponse.readResponseData(HTTPResponse.java:1011)
      at HTTPClient.HTTPResponse.getData(HTTPResponse.java:515)

I got hold of the source, and discovered that line 300 of StreamDemultiplexor.java was throwing the exception.

                      if (rcvd == -1)
                          throw new EOFException("Premature EOF encountered");

I commented out this code, rebuilt the Grinder jar, and my script then executed successfully against Apache
with no failures.

The only difference I could find in the output returned by Apache vs. IIS is that IIS uses two bytes, <CR><LF> to denote the end of a line, while Apache only uses one byte, <LF>. It seems to me that The Grinder is not taking account of this difference.

Examining the code, I suspect the fault lies in lines 1010-1011 of HTTPResponse.java:

      final int maximumBytes =
        Math.min(Data.length - off, bandwidthLimiter.maximumBytes(off));

Or in the calculations preceding it.

I am now happy, I have a work-around, but I'm sure the community would appreciate a proper fix.

----------------------------------------------------------------------

>Comment By: Philip Aston (philipa)
Date: 2011-03-21 19:26

Message:
The symptoms do appear to duplicate of 337866.

If Apache really is using <LF> and not <CR><LF> to denote the end of a
header line, or the delimiter between the headers and the body, it is
incorrect. This would be a fairly fundamental bug, so I assume the
difference you refer to is in the response body. This is allowed - see RFC
2616, 3.7.1.

I'll produce a debug patch to allow 337866 to be diagnosed. I'd be
grateful if you could try it out, and report your findings there. Closing
this bug as a duplicate..



----------------------------------------------------------------------

Comment By: Steven Swart (stevenswart)
Date: 2011-03-14 08:54

Message:
Duplicate of James Farrier's 'Premature EOF encountered' issue.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=3206627&group_id=18598

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.