You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Taso Lyristis <ta...@lyrisoft.com> on 2000/06/04 11:54:59 UTC

bug (?) with nsapi redirector on iPlanet 4.1 ?

Hello, 

I am experiencing a problem when invoking a JSP page that accepts a file
upload via a multipart request.  This particular page works when using
Tomcat directly, but fails when invoking it through iPlanet via the
redirector.  Furthermore, it also works with Apache and mod_jserv, so I
am concluding the the problem is somewhere in the netscape redirector.

My configuration: iPlanet 4.1 on Sun 2.6, Tomcat 3.1 release, Sun
JDK1.2.2.  Initially I was using the nsapi_redirector from the Tomcat
3.1 distribution, but I just upgraded to the latest from the public cvs
server.  They both show identical behavior with respect to this
problem.  The log excerpts below are from the more recent one, because
the old one didn't flush! :)

Below are some log excerpts (nsapi.log, tomcat stderr, and tomcat.log)
that occur right after I click submit:

==> nsapi.log <==
[jk_worker.c (123)]: Into wc_get_worker_for_name ajp12
[jk_worker.c (127)]: wc_get_worker_for_name, done  found a worker
[jk_ajp12_worker.c (223)]: Into jk_worker_t::get_endpoint
[jk_ajp12_worker.c (121)]: Into jk_endpoint_t::service
[jk_connect.c (108)]: Into jk_open_socket
[jk_connect.c (115)]: jk_open_socket, try to connect socket = 40
[jk_connect.c (124)]: jk_open_socket, after connect ret = 0
[jk_connect.c (132)]: jk_open_socket, set TCP_NODELAY to on
[jk_connect.c (140)]: jk_open_socket, return, sd = 40
[jk_ajp12_worker.c (134)]: In jk_endpoint_t::service, sd = 40
[jk_ajp12_worker.c (357)]: Into ajpv12_handle_request
[jk_ajp12_worker.c (361)]: ajpv12_handle_request, sending the ajp12
start sequence
[jk_ajp12_worker.c (395)]: ajpv12_handle_request, sending the headers
[jk_ajp12_worker.c (414)]: ajpv12_handle_request, sending the
terminating mark
[jk_ajp12_worker.c (427)]: ajpv12_handle_request, sending the request
body
[jk_ajp12_worker.c (441)]: ajpv12_handle_request, read 300 bytes
[jk_ajp12_worker.c (449)]: ajpv12_handle_request, sent 300 bytes
[jk_ajp12_worker.c (441)]: ajpv12_handle_request, read 5 bytes
[jk_ajp12_worker.c (449)]: ajpv12_handle_request, sent 5 bytes
[jk_ajp12_worker.c (441)]: ajpv12_handle_request, read 2 bytes
[jk_ajp12_worker.c (449)]: ajpv12_handle_request, sent 2 bytes
[jk_ajp12_worker.c (437)]: In ajpv12_handle_request, failed to read from
the web server
[jk_ajp12_worker.c (152)]: In jk_endpoint_t::service, Error sd = 40
[jk_ajp12_worker.c (163)]: Into jk_endpoint_t::done

==> Tomcat stderr <==
HANDLER THREAD PROBLEM: java.lang.NullPointerException
java.lang.NullPointerException
        at
org.apache.tomcat.service.connector.AJP12ResponseAdapter.sendStatus(Ajp12ConnectionHandler.java:439)
        at
org.apache.tomcat.service.http.HttpResponseAdapter.endHeaders(HttpResponseAdapter.java:111)
        at
org.apache.tomcat.core.BufferedServletOutputStream.sendHeaders(BufferedServletOutputStream.java:127)
        at
org.apache.tomcat.core.BufferedServletOutputStream.reallyFlush(BufferedServletOutputStream.java:239)
        at
org.apache.tomcat.core.BufferedServletOutputStream.close(BufferedServletOutputStream.java:258)
        at java.io.OutputStreamWriter.close(OutputStreamWriter.java:252)
        at java.io.PrintWriter.close(PrintWriter.java:138)
        at
org.apache.tomcat.core.ResponseImpl.finish(ResponseImpl.java:176)
        at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:158)
        at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
        at java.lang.Thread.run(Thread.java:479)

==> tomcat.log <==
Context log: path="/col" Error in jsp service() : Broken pipe
 javax.servlet.ServletException: Broken pipe
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.<init>(Throwable.java:94)
        at java.lang.Exception.<init>(Exception.java:42)
        at
javax.servlet.ServletException.<init>(ServletException.java:161)
        at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:375)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
        at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:156)
        at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
        at java.lang.Thread.run(Thread.java:479)
Context log: path="/col" <b>Internal Servlet Error:</b><br>
<pre>
javax.servlet.ServletException: Broken pipe
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.<init>(Throwable.java:94)
        at java.lang.Exception.<init>(Exception.java:42)
        at
javax.servlet.ServletException.<init>(ServletException.java:161)
        at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:375)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
        at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:156)
        at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
        at java.lang.Thread.run(Thread.java:479)
</pre>
<b>Root cause:</b>
<pre>
java.io.IOException: Broken pipe
        at java.net.SocketOutputStream.socketWrite(Native Method)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:75)
        at
org.apache.tomcat.service.http.HttpResponseAdapter.endHeaders(HttpResponseAdapter.java:122)
        at
org.apache.tomcat.core.BufferedServletOutputStream.sendHeaders(BufferedServletOutputStream.java:127)
        at
org.apache.tomcat.core.BufferedServletOutputStream.reallyFlush(BufferedServletOutputStream.java:239)
        at
org.apache.tomcat.core.ResponseImpl.flushBuffer(ResponseImpl.java:330)
        at
org.apache.tomcat.core.HttpServletResponseFacade.flushBuffer(HttpServletResponseFacade.java:235)
        at
org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:195)
        at
_0002fprofile_0005fsubmit_0002ejspprofile_0005fsubmit_jsp_0._jspService(_0002fprofile_0005fsubmit_0002ejspprofile_0005fsubmit_jsp_0.java:272)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
        at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
        at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
        at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:156)
        at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
        at java.lang.Thread.run(Thread.java:479)
</pre>

Context log: path="/col" Broken pipe /col/profile_submit.jsp

Has anyone seen or heard of this before??  I'd be happy to provide more
detail if needed.

Thanks,
Taso Lyristis

Re: bug (?) with nsapi redirector on iPlanet 4.1 ?

Posted by Taso Lyristis <ta...@lyrisoft.com>.
Gal Shachor wrote:
> 
> I have made a change to the NSAPI code, it *should* fix this bug.
> Can you try to extract the latest NSAPI code from the CVS and check
> it out? (if you want me I can send you an NT binary)
> 
>         Gal Shachor

Yes!  You've done it!  You have my sincere gratitude.

Some comments:
In order to compile, I had to comment out a line from the Makefile:

nsapi_redirector.so: $(JK_OBJS)
#       $(MAKE) prepare
        $(LD_SHAREDCMD) $(JK_OBJS) -o nsapi_redirector.so
$(EXTRA_LDDEFINES)

I'm using GNU make 3.78.1.

Also, I had to comment out this line from jk_worker_list.h:
/*            { JK_AJP13_WORKER_NAME, ajp13_worker_factory}, */

This is in the block where the worker_factories array is defined.  If
this line is left in, then I get an error when starting iPlanet.  I
think the error was "undefined reference" or something; if you like, I
can get the exact message for you).  [By the way, I am running on
Solaris, not NT, if that makes a difference].

Finally, I can see from the nsapi.log that ajp12_handle_request reads
and sends 1448 bytes at a time, and occasionally, 2896 bytes.  Is this
an inefficiency?  If you were to use netbuf_grab() or net_read() rather
than netbuf_getc(), do you think the reads would happen in larger
chunks?  (I only ask because I was looking at some sample NSAPI code
yesterday and it was using netbuf_grab).

These issues are pretty minor.  All in all, I am extremely happy right
now.  Thank you so much.

-Taso

Re: bug (?) with nsapi redirector on iPlanet 4.1 ?

Posted by Taso Lyristis <ta...@lyrisoft.com>.
Gal Shachor wrote:
> 
> I have made a change to the NSAPI code, it *should* fix this bug.
> Can you try to extract the latest NSAPI code from the CVS and check
> it out? (if you want me I can send you an NT binary)
> 
>         Gal Shachor

Yes!  You've done it!  You have my sincere gratitude.

Some comments:
In order to compile, I had to comment out a line from the Makefile:

nsapi_redirector.so: $(JK_OBJS)
#       $(MAKE) prepare
        $(LD_SHAREDCMD) $(JK_OBJS) -o nsapi_redirector.so
$(EXTRA_LDDEFINES)

I'm using GNU make 3.78.1.

Also, I had to comment out this line from jk_worker_list.h:
/*            { JK_AJP13_WORKER_NAME, ajp13_worker_factory}, */

This is in the block where the worker_factories array is defined.  If
this line is left in, then I get an error when starting iPlanet.  I
think the error was "undefined reference" or something; if you like, I
can get the exact message for you).  [By the way, I am running on
Solaris, not NT, if that makes a difference].

Finally, I can see from the nsapi.log that ajp12_handle_request reads
and sends 1448 bytes at a time, and occasionally, 2896 bytes.  Is this
an inefficiency?  If you were to use netbuf_grab() or net_read() rather
than netbuf_getc(), do you think the reads would happen in larger
chunks?  (I only ask because I was looking at some sample NSAPI code
yesterday and it was using netbuf_grab).

These issues are pretty minor.  All in all, I am extremely happy right
now.  Thank you so much.

-Taso

Re: bug (?) with nsapi redirector on iPlanet 4.1 ?

Posted by Gal Shachor <sh...@il.ibm.com>.
I have made a change to the NSAPI code, it *should* fix this bug.
Can you try to extract the latest NSAPI code from the CVS and check 
it out? (if you want me I can send you an NT binary)

	Gal Shachor

Re: bug (?) with nsapi redirector on iPlanet 4.1 ?

Posted by Gal Shachor <sh...@il.ibm.com>.

Taso Lyristis wrote:
> 
> Below are some log excerpts (nsapi.log, tomcat stderr, and tomcat.log)
> that occur right after I click submit:
> 
> ==> nsapi.log <==
> [jk_worker.c (123)]: Into wc_get_worker_for_name ajp12
> [jk_worker.c (127)]: wc_get_worker_for_name, done  found a worker
> [jk_ajp12_worker.c (223)]: Into jk_worker_t::get_endpoint
> [jk_ajp12_worker.c (121)]: Into jk_endpoint_t::service
> [jk_connect.c (108)]: Into jk_open_socket
> [jk_connect.c (115)]: jk_open_socket, try to connect socket = 40
> [jk_connect.c (124)]: jk_open_socket, after connect ret = 0
> [jk_connect.c (132)]: jk_open_socket, set TCP_NODELAY to on
> [jk_connect.c (140)]: jk_open_socket, return, sd = 40
> [jk_ajp12_worker.c (134)]: In jk_endpoint_t::service, sd = 40
> [jk_ajp12_worker.c (357)]: Into ajpv12_handle_request
> [jk_ajp12_worker.c (361)]: ajpv12_handle_request, sending the ajp12
> start sequence
> [jk_ajp12_worker.c (395)]: ajpv12_handle_request, sending the headers
> [jk_ajp12_worker.c (414)]: ajpv12_handle_request, sending the
> terminating mark
> [jk_ajp12_worker.c (427)]: ajpv12_handle_request, sending the request
> body
> [jk_ajp12_worker.c (441)]: ajpv12_handle_request, read 300 bytes
> [jk_ajp12_worker.c (449)]: ajpv12_handle_request, sent 300 bytes
> [jk_ajp12_worker.c (441)]: ajpv12_handle_request, read 5 bytes
> [jk_ajp12_worker.c (449)]: ajpv12_handle_request, sent 5 bytes
> [jk_ajp12_worker.c (441)]: ajpv12_handle_request, read 2 bytes
> [jk_ajp12_worker.c (449)]: ajpv12_handle_request, sent 2 bytes
> [jk_ajp12_worker.c (437)]: In ajpv12_handle_request, failed to read from

What's written here is that the nsapi_redirector failed to read your
upload data from the web server! It first read 300byte and then 
another 5,5,2 and 2 bytes but then the server returned an error
response! 

The exact loop that breaks is 
            for(i = 0 ; i < l ; i++) {
                ch = netbuf_getc(inbuf);              
                if(IO_ERROR == ch || IO_EOF == ch) {
                    break;
                }

                buf[i] = ch;
            }
So as you see, the server returns information that specifies end of file 
or even worst IO error. 

As a result of this error the redirector closed the connection to Tomcat
and this is why you got the exception.

I must say that this is rather puzzling, but I do not think that this is 
a redirector bug, I mean, I act according to the "instruction" that the
server
gives me... It looks as if Netscape fails to read the uploaded file.

	Gal Shachor

Re: bug (?) with nsapi redirector on iPlanet 4.1 ?

Posted by Gal Shachor <sh...@il.ibm.com>.
I have made a change to the NSAPI code, it *should* fix this bug.
Can you try to extract the latest NSAPI code from the CVS and check 
it out? (if you want me I can send you an NT binary)

	Gal Shachor

Re: bug (?) with nsapi redirector on iPlanet 4.1 ?

Posted by Gal Shachor <sh...@il.ibm.com>.

Taso Lyristis wrote:
> 
> Below are some log excerpts (nsapi.log, tomcat stderr, and tomcat.log)
> that occur right after I click submit:
> 
> ==> nsapi.log <==
> [jk_worker.c (123)]: Into wc_get_worker_for_name ajp12
> [jk_worker.c (127)]: wc_get_worker_for_name, done  found a worker
> [jk_ajp12_worker.c (223)]: Into jk_worker_t::get_endpoint
> [jk_ajp12_worker.c (121)]: Into jk_endpoint_t::service
> [jk_connect.c (108)]: Into jk_open_socket
> [jk_connect.c (115)]: jk_open_socket, try to connect socket = 40
> [jk_connect.c (124)]: jk_open_socket, after connect ret = 0
> [jk_connect.c (132)]: jk_open_socket, set TCP_NODELAY to on
> [jk_connect.c (140)]: jk_open_socket, return, sd = 40
> [jk_ajp12_worker.c (134)]: In jk_endpoint_t::service, sd = 40
> [jk_ajp12_worker.c (357)]: Into ajpv12_handle_request
> [jk_ajp12_worker.c (361)]: ajpv12_handle_request, sending the ajp12
> start sequence
> [jk_ajp12_worker.c (395)]: ajpv12_handle_request, sending the headers
> [jk_ajp12_worker.c (414)]: ajpv12_handle_request, sending the
> terminating mark
> [jk_ajp12_worker.c (427)]: ajpv12_handle_request, sending the request
> body
> [jk_ajp12_worker.c (441)]: ajpv12_handle_request, read 300 bytes
> [jk_ajp12_worker.c (449)]: ajpv12_handle_request, sent 300 bytes
> [jk_ajp12_worker.c (441)]: ajpv12_handle_request, read 5 bytes
> [jk_ajp12_worker.c (449)]: ajpv12_handle_request, sent 5 bytes
> [jk_ajp12_worker.c (441)]: ajpv12_handle_request, read 2 bytes
> [jk_ajp12_worker.c (449)]: ajpv12_handle_request, sent 2 bytes
> [jk_ajp12_worker.c (437)]: In ajpv12_handle_request, failed to read from

What's written here is that the nsapi_redirector failed to read your
upload data from the web server! It first read 300byte and then 
another 5,5,2 and 2 bytes but then the server returned an error
response! 

The exact loop that breaks is 
            for(i = 0 ; i < l ; i++) {
                ch = netbuf_getc(inbuf);              
                if(IO_ERROR == ch || IO_EOF == ch) {
                    break;
                }

                buf[i] = ch;
            }
So as you see, the server returns information that specifies end of file 
or even worst IO error. 

As a result of this error the redirector closed the connection to Tomcat
and this is why you got the exception.

I must say that this is rather puzzling, but I do not think that this is 
a redirector bug, I mean, I act according to the "instruction" that the
server
gives me... It looks as if Netscape fails to read the uploaded file.

	Gal Shachor