Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349430

Summary: Jetty 7x access jsp file error using ajp protocol
Product: [RT] Jetty Reporter: wangxinsheng <gady2003>
Component: otherAssignee: Project Inbox <jetty-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: mgorovoy, weijx2003
Version: unspecified   
Target Milestone: 7.2.x   
Hardware: All   
OS: All   
Whiteboard:

Description wangxinsheng CLA 2011-06-15 09:09:31 EDT
Build Identifier: 7.3.1.v20110307

  using apache 2.15+mod_jk+Jetty7.3.1 access jsp page,event the jsp file generated  by a txt file such as  linux command of mv a.txt a.jsp. access errors as follow:
[Wed Jun 15 16:37:08.004 2011] [27849:1123723584] [error] ajp_connection_tcp_get_message::jk_ajp_common.c (1312): (local) can't receive the response body message from tomcat, tomcat (127.0.0.1:8009) has forced a connection close for socket 14
[Wed Jun 15 16:37:08.004 2011] [27849:1123723584] [error] ajp_get_reply::jk_ajp_common.c (2085): (local) Tomcat is down or network problems. Part of the response has already been sent to the client
the same error occured on 7.1.6,but when jetty version change to 6.1.22,errors does not occurred!

Reproducible: Always
Comment 1 wangxinsheng CLA 2011-06-16 02:48:14 EDT
While debuging ,I found that  the class of Ajp13Generator has a method which can't executed for the _buffer is not null. the source code as follows:
 private void initContent() throws IOException
    {
        if (_buffer == null)
        {
            _buffer = _buffers.getBuffer(_contentBufferSize);
            _buffer.setPutIndex(7);
            _buffer.setGetIndex(7);
        }
    }

Next step ,the method increaseContentBufferSize in class AbstractGenerator as follows has inited the buffer field.  
 public void increaseContentBufferSize(int contentBufferSize)
    {
        if (_buffer==null)
            _buffer=_buffers.getBuffer();
        if (contentBufferSize > _buffer.capacity())
        {
            Buffer nb = _buffers.getBuffer(contentBufferSize);
            nb.put(_buffer);
            _buffers.returnBuffer(_buffer);
            _buffer = nb;
        }
    }

 the buffer of 6.x has not inited,as follow is jetty6.1.22 source code :
public void increaseContentBufferSize(int contentBufferSize)
    {
        if (contentBufferSize > _contentBufferSize)
        {
            _contentBufferSize = contentBufferSize;
            if (_buffer != null)
            {
                Buffer nb = _buffers.getBuffer(_contentBufferSize);
                nb.put(_buffer);
                _buffers.returnBuffer(_buffer);
                _buffer = nb;
            }
        }
    }
Comment 2 weijx CLA 2011-06-24 05:38:07 EDT
Jetty7.4 fix this bug

https://bugs.eclipse.org/bugs/show_bug.cgi?id=341694
Comment 3 Michael Gorovoy CLA 2011-06-27 16:41:02 EDT
Marking this bug as duplicate of bug 341694. Please re-open if the fix doesn't work in your environment.

*** This bug has been marked as a duplicate of bug 341694 ***