You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Doug Davis <du...@us.ibm.com> on 2001/01/05 12:54:32 UTC

Re: Stability of current source? (Try this, please. IMHO it does not work)

> I am still convinced that a fix to the CVS tree has higher
> priority then a feature in the NOT working tree! It only
> breaks when you use it :-)  Doug has an interesting 'ethical'
> decision to make! I hope he did not attend the 'good enough'
> school of Quality Control: It compiles, ship it!

Not really much of a question is it?  8-)
To me, bugs are a fact of life and we can't stop them from
being introduced so what's more important to me is what
happens after they're injected.  There are a couple of things
that I'd like to focus on:
  1 - as new function is added new tests should be added as
      well to test this new function and in particular test
      its interactions with the existing code.
  2 - all committers should run all existing tests before they
      commit their code (and they need to pass  8-)
  3 - once a bug is found how does the 'bad' coder react.  If
      they own up to the bug right away and jump right on
      fixing it then I think all is well.  Its the coder that's
      in denial that we need to worry about.  8-)
I've actually been really pleased over the last couple of days
with people's willingness to help track this bug down.  Yes,
it took a little while for people to take notice, but I'm really
happy with how many people jumped in to help and how quickly its
being resolved.
-Dug



Re: Stability of current source?

Posted by "Diane l. Davison" <Di...@oracle.com>.
This fix works for me.  Thanks!

Solaris7
JDK 1.2.2
Tomcat 3.1
Xerces 1.1.3
JAF 1.0.1
JavaMail 1.1.3

Diane

Wouter Cloetens wrote:

> OK. After putting a BufferInputStream and BufferedOutputStream in between
> and taking out the two CR/LFs at the end of the request (which I'm
> convinced is required by some webservers and may cause problems),
> everything now runs smoothly.
> It's all a very JVM- and OS-specific timing issue. Depending on how the TCP
> flow is broken up into TCP packets, it'll work or not. For instance,
> disabling the JIT compiler on the IBM Linux JVM made the version in CVS
> work reliably too...
>
> I'm attaching the fixed file. I'd like to test it on some other platforms
> and web servers before cleaning up the changes and committing them.
>
> bfn, Wouter
>
> Wouter Cloetens wrote:
>
> > Ok, now I so annoyed that I setup an environment to recreate the
> > problem. Running Linux with both the Sun 1.3 standard edition JVM and
> > the IBM Java 1.1.8 JVM, and Tomcat 3.2.1, I can recreate the problem. It
> > happens very often with the Sun JVM, hardly ever with the IBM JVM. This
> > never happened with the same IBM JVM on AIX, 1.1.7 on OS/2 or 1.2.2 on
> > Windows NT.
> > Sometimes the server response is blank, sometimes it's complete but the
> > client still throws its exception. It's as if the JVM stops allowing a
> > read from the OutputStream on the socket when the socket's been closed
> > (even if the data hasn't been read completely yet). I'm spooked by all
> > this, but I'm on it like a bloodhound.
> >
> > bfn, Wouter
>
>   ----------------------------------------------------------------------------------------------------
>                      Name: HTTPUtils.java
>    HTTPUtils.java    Type: Plain Text (text/plain)
>                  Encoding: 7bit


Re: Stability of current source? A OK!!!!

Posted by George I Matkovits <ma...@uswest.net>.
It works for me on Win2k with Apache1.3.12 / Tomcat3.2B1 and sample configurations of
the 0104 CVS tree (I do not use the  stockquote sample).
Thank you for the very EXTRA effort!

I hope we will not have any more 'big time' CVS tree problems for some time to come.
I looked briefly at your code, it is really wonderful what a professional Java
programmer can do in a few lines of Java code.
C# will need real 'extra' effort to get here .....(-:
Thank you - George

p.s. I will add now the SecureSoap stuff and will do some more testing on Linux with
SSL. I will let you know the results by Monday.

Wouter Cloetens wrote:

> OK. After putting a BufferInputStream and BufferedOutputStream in between
> and taking out the two CR/LFs at the end of the request (which I'm
> convinced is required by some webservers and may cause problems),
> everything now runs smoothly.
> It's all a very JVM- and OS-specific timing issue. Depending on how the TCP
> flow is broken up into TCP packets, it'll work or not. For instance,
> disabling the JIT compiler on the IBM Linux JVM made the version in CVS
> work reliably too...
>
> I'm attaching the fixed file. I'd like to test it on some other platforms
> and web servers before cleaning up the changes and committing them.
>
> bfn, Wouter
>
> Wouter Cloetens wrote:
>
> > Ok, now I so annoyed that I setup an environment to recreate the
> > problem. Running Linux with both the Sun 1.3 standard edition JVM and
> > the IBM Java 1.1.8 JVM, and Tomcat 3.2.1, I can recreate the problem. It
> > happens very often with the Sun JVM, hardly ever with the IBM JVM. This
> > never happened with the same IBM JVM on AIX, 1.1.7 on OS/2 or 1.2.2 on
> > Windows NT.
> > Sometimes the server response is blank, sometimes it's complete but the
> > client still throws its exception. It's as if the JVM stops allowing a
> > read from the OutputStream on the socket when the socket's been closed
> > (even if the data hasn't been read completely yet). I'm spooked by all
> > this, but I'm on it like a bloodhound.
> >
> > bfn, Wouter
>
>   ------------------------------------------------------------
> /*
>  * The Apache Software License, Version 1.1
>  *
>  *
>  * Copyright (c) 2000 The Apache Software Foundation.  All rights
>  * reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>  * modification, are permitted provided that the following conditions
>  * are met:
>  *
>  * 1. Redistributions of source code must retain the above copyright
>  *    notice, this list of conditions and the following disclaimer.
>  *
>  * 2. Redistributions in binary form must reproduce the above copyright
>  *    notice, this list of conditions and the following disclaimer in
>  *    the documentation and/or other materials provided with the
>  *    distribution.
>  *
>  * 3. The end-user documentation included with the redistribution,
>  *    if any, must include the following acknowledgment:
>  *       "This product includes software developed by the
>  *        Apache Software Foundation (http://www.apache.org/)."
>  *    Alternately, this acknowledgment may appear in the software itself,
>  *    if and wherever such third-party acknowledgments normally appear.
>  *
>  * 4. The names "SOAP" and "Apache Software Foundation" must
>  *    not be used to endorse or promote products derived from this
>  *    software without prior written permission. For written
>  *    permission, please contact apache@apache.org.
>  *
>  * 5. Products derived from this software may not be called "Apache",
>  *    nor may "Apache" appear in their name, without prior written
>  *    permission of the Apache Software Foundation.
>  *
>  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
>  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
>  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
>  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>  * SUCH DAMAGE.
>  * ====================================================================
>  *
>  * This software consists of voluntary contributions made by many
>  * individuals on behalf of the Apache Software Foundation and was
>  * originally based on software copyright (c) 2000, International
>  * Business Machines, Inc., http://www.apache.org.  For more
>  * information on the Apache Software Foundation, please see
>  * <http://www.apache.org/>.
>  */
>
> package org.apache.soap.util.net;
>
> import java.net.*;
> import java.io.*;
> import java.util.*;
>
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
> import org.apache.soap.transport.*;
> import org.apache.soap.util.mime.*;
> import javax.mail.*;
> import javax.mail.internet.*;
> import javax.activation.*;
> import java.lang.reflect.*;
>
> /**
>  * A bunch of utility stuff for doing HTTP things.
>  * <p>
>  * 2000/07/30 W. Cloetens     added Multipart Mime support
>  *
>  * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
>  * @author Matthew J. Duftler (duftler@us.ibm.com)
>  * @author Wouter Cloetens (wcloeten@raleigh.ibm.com)
>  */
> public class HTTPUtils {
>   private static final String HTTP_VERSION = "1.0";
>   private static final int    HTTP_DEFAULT_PORT = 80;
>   private static final int    HTTPS_DEFAULT_PORT = 443;
>
>   /**
>    * This method either creates a socket or calls SSLUtils to
>    * create an SSLSocket.  It uses reflection to avoid a compile time
>    * dependency on SSL.
>    *
>    * @author Chris Nelson
>    */
>   private static Socket buildSocket(URL url, int targetPort,
>                                     String httpProxyHost, int httpProxyPort)
>      throws Exception {
>       Socket s = null;
>       String host = null;
>       int port;
>
>       if (httpProxyHost == null) {
>           host = url.getHost();
>           port = targetPort;
>       } else {
>           host = httpProxyHost;
>           port = httpProxyPort;
>       }
>
>       if (url.getProtocol().equalsIgnoreCase("HTTPS")) {
>           // Using reflection to avoid compile time dependencies
>           Class SSLUtilsClass =
>               Class.forName("org.apache.soap.util.net.SSLUtils");
>           Class[] paramTypes = new Class[] {String.class, int.class};
>           Method buildSSLSocket = SSLUtilsClass.getMethod(
>               "buildSSLSocket", paramTypes);
>           Object[] params = new Object[] {host, new Integer(port)};
>           s = (Socket)buildSSLSocket.invoke(null, params);
>       } else {
>           s = new Socket(host, port);
>       }
>
>       return s;
>    }
>
>   /**
>    * Utility function to determine port number from URL object.
>    *
>    * @param url URL object from which to determine port number
>    * @return port number
>    */
>   private static int getPort(URL url) throws IOException {
>       int port = url.getPort();
>       if (port < 0)  // No port given, use HTTP or HTTPS default
>           if (url.getProtocol().equalsIgnoreCase("HTTPS"))
>               port = HTTPS_DEFAULT_PORT;
>           else
>               port = HTTP_DEFAULT_PORT;
>       return port;
>   }
>
>       // static byte[] tail = {'\r','\n','\r','\n'};
>   /**
>    * POST something to the given URL. The headers are put in as
>    * HTTP headers, the content length is calculated and the content
>    * byte array is sent as the POST content.
>    *
>    * @param url the url to post to
>    * @param request the message
>    * @param timeout the amount of time, in ms, to block on reading data
>    * @param httpProxyHost the HTTP proxy host or null if no proxy
>    * @param httpProxyPort the HTTP proxy port, if the proxy host is not null
>    */
>   public static TransportMessage post(URL url, TransportMessage request,
>                                       int timeout,
>                                       String httpProxyHost, int httpProxyPort)
>       throws IllegalArgumentException, IOException, SOAPException {
>       /* Open the connection */
>       OutputStream outStream = null;
>       InputStream inStream = null;
>       BufferedReader in = null;
>       int port;
>       Socket s;
>       try {
>           port = getPort(url);
>
>           s = buildSocket(url, port, httpProxyHost, httpProxyPort);
>
>           if (timeout > 0)  // Should be redundant but not every JVM likes this
>               s.setSoTimeout(timeout);
>
>           outStream = s.getOutputStream ();
>           inStream = s.getInputStream ();
>       }
>       catch (Exception e) {
>           throw new IllegalArgumentException("Error opening socket: " +
>                                              e.getMessage ());
>       }
>
>       /* Construct the HTTP header. */
>       StringBuffer headerbuf = new StringBuffer();
>       headerbuf.append(Constants.HEADER_POST).append(' ')
>           .append(httpProxyHost == null ? url.getFile() : url.toString())
>           .append(" HTTP/").append(HTTP_VERSION).append("\r\n")
>           .append(Constants.HEADER_HOST).append(": ").append(url.getHost())
>           .append(':').append(port).append("\r\n")
>           .append(Constants.HEADER_CONTENT_TYPE).append(": ")
>           .append(request.getContentType()).append("\r\n")
>           .append(Constants.HEADER_CONTENT_LENGTH).append(": ")
>           .append(request.getContentLength()).append("\r\n");
>       for (Enumeration e = request.getHeaderNames(); e.hasMoreElements(); ) {
>           Object key = e.nextElement();
>           headerbuf.append(key).append(": ")
>               .append(request.getHeader((String)key)).append("\r\n");
>       }
>       headerbuf.append("\r\n");
>
>       try {
>       /* Send the request. */
> /*
>       byte[] hdrs =
>           headerbuf.toString().getBytes(Constants.HEADERVAL_DEFAULT_CHARSET);
>       byte[] content = request.getBytes();
>       byte[] all = new byte[hdrs.length + content.length + tail.length];
>       System.arraycopy(hdrs, 0, all, 0, hdrs.length);
>       System.arraycopy(content, 0, all, hdrs.length, content.length);
>       System.arraycopy(tail, 0, all, hdrs.length + content.length, tail.length);
>       outStream.write(all);
> */
>       BufferedOutputStream bOutStream = new BufferedOutputStream(outStream);
>       bOutStream.write(
>           headerbuf.toString().getBytes(Constants.HEADERVAL_DEFAULT_CHARSET));
>       request.writeTo(bOutStream);
>       //bOutStream.write(request.getBytes());
>       //bOutStream.write('\r'); bOutStream.write('\n');
>       //bOutStream.write('\r'); bOutStream.write('\n');
>       bOutStream.flush();
>       outStream.flush();
>
>       BufferedInputStream bInStream = new BufferedInputStream(inStream);
>       /* Read the response status line. */
>       int statusCode = 0;
>       String statusString = null;
>       StringBuffer linebuf = new StringBuffer();
>       int b = 0;
>       while (b != '\n' && b != -1) {
>           b = bInStream.read();
>           if (b != '\n' && b != '\r' && b != -1)
>               linebuf.append((char)b);
>       }
>       String line = linebuf.toString();
>       try {
>           StringTokenizer st = new StringTokenizer(line);
>           st.nextToken(); // ignore version part
>           statusCode = Integer.parseInt (st.nextToken());
>           StringBuffer sb = new StringBuffer();
>           while (st.hasMoreTokens()) {
>               sb.append (st.nextToken());
>               if (st.hasMoreTokens()) {
>                   sb.append(" ");
>               }
>           }
>           statusString = sb.toString();
>       }
>       catch (Exception e) {
>           throw new IllegalArgumentException("Error parsing HTTP status line: " +
>                                              e.getMessage());
>       }
>
>       /* Read the entire response (following the status line)
>        * into a byte array. */
>       ByteArrayDataSource ds = new ByteArrayDataSource(bInStream,
>                           Constants.HEADERVAL_DEFAULT_CHARSET);
>
>       /* Extract the headers, content type and content length. */
>       byte[] bytes = ds.toByteArray();
>       Hashtable respHeaders = new Hashtable();
>       int respContentLength = -1;
>       String respContentType = null;
>       StringBuffer namebuf = new StringBuffer();
>       StringBuffer valuebuf = new StringBuffer();
>       boolean parsingName = true;
>       int offset;
>       for (offset = 0; offset < bytes.length; offset++) {
>           if (bytes[offset] == '\n') {
>               if (namebuf.length() == 0)
>                   break;
>               String name = namebuf.toString();
>               String value = valuebuf.toString();
>               if (name.equalsIgnoreCase(Constants.HEADER_CONTENT_LENGTH))
>                   respContentLength = Integer.parseInt(value);
>               else if (name.equalsIgnoreCase(Constants.HEADER_CONTENT_TYPE))
>                   respContentType = value;
>               else
>                   respHeaders.put(name, value);
>               namebuf = new StringBuffer();
>               valuebuf = new StringBuffer();
>               parsingName = true;
>           }
>           else if (bytes[offset] != '\r') {
>               if (parsingName) {
>                   if (bytes[offset] == ':') {
>                       parsingName = false;
>                       offset++;
>                   }
>                   else
>                       namebuf.append((char)bytes[offset]);
>               }
>               else
>                   valuebuf.append((char)bytes[offset]);
>           }
>       }
>       InputStream is = ds.getInputStream();
>       is.skip(offset + 1);
>
>       /* Construct the response object. */
>       SOAPContext ctx;
>       TransportMessage response;
>       try {
>           // Create response SOAPContext.
>           ctx = new SOAPContext();
>           // Read content.
>           response = new TransportMessage(is, respContentLength,
>                                           respContentType, ctx, respHeaders);
>           // Extract envelope and SOAPContext
>           response.read();
>           // Associate SOAPContext with current thread.
>           ctx.setSOAPContext();
>       } catch (MessagingException me) {
>           throw new IllegalArgumentException("Error parsing response: " + me);
>       }
>
>       /* All done here! */
>       bOutStream.close();
>       outStream.close();
>       bInStream.close();
>       inStream.close();
>       s.close();
>       return response;
>       } catch (IOException ioe) { ioe.printStackTrace(); throw ioe; }
>   }
> }


Re: Stability of current source?

Posted by Wouter Cloetens <wc...@raleigh.ibm.com>.
OK. After putting a BufferInputStream and BufferedOutputStream in between
and taking out the two CR/LFs at the end of the request (which I'm
convinced is required by some webservers and may cause problems),
everything now runs smoothly.
It's all a very JVM- and OS-specific timing issue. Depending on how the TCP
flow is broken up into TCP packets, it'll work or not. For instance,
disabling the JIT compiler on the IBM Linux JVM made the version in CVS
work reliably too...

I'm attaching the fixed file. I'd like to test it on some other platforms
and web servers before cleaning up the changes and committing them.

bfn, Wouter

Wouter Cloetens wrote:

> Ok, now I so annoyed that I setup an environment to recreate the
> problem. Running Linux with both the Sun 1.3 standard edition JVM and
> the IBM Java 1.1.8 JVM, and Tomcat 3.2.1, I can recreate the problem. It
> happens very often with the Sun JVM, hardly ever with the IBM JVM. This
> never happened with the same IBM JVM on AIX, 1.1.7 on OS/2 or 1.2.2 on
> Windows NT.
> Sometimes the server response is blank, sometimes it's complete but the
> client still throws its exception. It's as if the JVM stops allowing a
> read from the OutputStream on the socket when the socket's been closed
> (even if the data hasn't been read completely yet). I'm spooked by all
> this, but I'm on it like a bloodhound.
>
> bfn, Wouter

Re: Stability of current source?

Posted by George I Matkovits <ma...@uswest.net>.
Great! Some of this problem I have seen about a year ago with the 1st
version of Java2 on an NT4.0 Workstation and a home-brew messaging system. I
got strange and wonderful socket problems (which I fixed with various
retries and time-out hacks)  which very much looked like JVM issues (but
only under high stress conditions). A NOT working application was not an
option for me! I had as many as 5000 Java threads sending/receiving/queuing
messages within and between 2 NT Systems (the other one was an NT4 Server).
IMHO this (or its sister) problem has been lurking in the Java Socket
Libraries (JVM?) for a very long time and only manifests itself under
'strange' stress conditions. I hope you will be able to isolate it and then
get it fixed by SunSoft! (-:
Regards - George

p.s. I definitive fix (or even a simple stress test) would be a great boon
to the Java Networking Community.(-:

Wouter Cloetens wrote:

> Ok, now I so annoyed that I setup an environment to recreate the
> problem. Running Linux with both the Sun 1.3 standard edition JVM and
> the IBM Java 1.1.8 JVM, and Tomcat 3.2.1, I can recreate the problem. It
> happens very often with the Sun JVM, hardly ever with the IBM JVM. This
> never happened with the same IBM JVM on AIX, 1.1.7 on OS/2 or 1.2.2 on
> Windows NT.
> Sometimes the server response is blank, sometimes it's complete but the
> client still throws its exception. It's as if the JVM stops allowing a
> read from the OutputStream on the socket when the socket's been closed
> (even if the data hasn't been read completely yet). I'm spooked by all
> this, but I'm on it like a bloodhound.
>
> bfn, Wouter


soap exception

Posted by Frank Starsinic <fs...@apengines.com>.
I'm getting the error below when invoking our soap call to the server.
I'm also doing a Tcp trace and the return xml stuff looks just right.

any ideas?

invoking...
Caught SOAPException (SOAP-ENV:Client): No Deserializer found to deserialize
a 'http://www.w3.org/1999/XMLSchema:integer'
using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.>


thanks,

frank


RE: Stability of current source?

Posted by graham glass <gr...@mindspring.com>.
hi wouter,

it's possible that it's the underlying operating system
implementations of sockets are causing the behavior you're
seeing, not the VM at all.

the socket failure problem was the biggest pain in my
entire SOAP implementation work. everything seemed to be
working on win2000 fine, but then my code started
failing on solaris. it took a while to figure out what
was going on, but then i ended up reproducing the error
on win2000 and tracked down the core cause.

code for HTTP routing in all keep-alive/non-keep-alive 
combinations was particularly tricky, since the router 
seems to be copying bytes from the source to the destination
ok, and then finds out a couple of writes later that the 
connection had been broken all along - so it has to remember 
what it wrote so far, re-establish the connection, and then 
write it all over again.

if it indeed is the same problem, then adding the 
simple buffer stream won't work (as you've discovered).

good luck!

cheers,
graham

-----Original Message-----
From: zombie@gnkhelp308.greenock.uk.ibm.com
[mailto:zombie@gnkhelp308.greenock.uk.ibm.com]On Behalf Of Wouter
Cloetens
Sent: Friday, January 05, 2001 7:00 PM
To: soap-dev@xml.apache.org
Subject: Re: Stability of current source?


Yes, Graham, it is actually something like that. The write() of the CR/LFs
at the end of the request could very well fail because the uplink TCP
connection already had its half-close done (though I thought that it was
always the side that wrote output that had to initiate that?). I'll run a
packet trace to see if that's true. That behaviour I could understand.
Getting the failure not only on write(), but also on subsequent read()s,
baffles me.

If I write the whole request as one big byte array, everything works
peachy. I thought then that inserting a BufferedOutputStream might do the
trick, but that chokes too, which is really a convincing argument in
support of the theory that the JVMs are at fault. Write Once, Debug
Everywhere...

bfn, Wouter

graham glass wrote:

> hi wouter,
>
> even tho i'm not on the apache development team, i'll describe
> an experience that i had building my own SOAP implementation
> that may or may not be relevant.
>
> in my case, the problem lay with socket behavior and keep alive
> connections. i was writing programs that talked to each other
> and sent a set of messages in a row. the client was a "keep alive"
> client but the server was not.
>
> the odd thing i found was that when the server closed its socket
> connection after receiving and sending back a single response,
> the client was able to write *another* message to the same
> socket connection even though the server had closed its end,
> and the client only received an exception after it had made
> several calls to write().
>
> the behavior of write() seems to be that it'll accept at least
> a few bytes on a broken connection and its only when it attempts
> to flush some of the bytes that it finally realises that there's
> a connection problem.
>
> i wrote a small program to verify this behavior, and was able to
> reproduce the problem with a tiny amount of code, so i'm 100% that
> this behavior exists.
>
> might this explain what you're seeing?
>
> cheers,
> graham
>
> -----Original Message-----
> From: zombie@gnkhelp308.greenock.uk.ibm.com
> [mailto:zombie@gnkhelp308.greenock.uk.ibm.com]On Behalf Of Wouter
> Cloetens
> Sent: Friday, January 05, 2001 3:32 PM
> To: soap-dev@xml.apache.org
> Subject: Re: Stability of current source?
>
> Ok, now I so annoyed that I setup an environment to recreate the
> problem. Running Linux with both the Sun 1.3 standard edition JVM and
> the IBM Java 1.1.8 JVM, and Tomcat 3.2.1, I can recreate the problem. It
> happens very often with the Sun JVM, hardly ever with the IBM JVM. This
> never happened with the same IBM JVM on AIX, 1.1.7 on OS/2 or 1.2.2 on
> Windows NT.
> Sometimes the server response is blank, sometimes it's complete but the
> client still throws its exception. It's as if the JVM stops allowing a
> read from the OutputStream on the socket when the socket's been closed
> (even if the data hasn't been read completely yet). I'm spooked by all
> this, but I'm on it like a bloodhound.
>
> bfn, Wouter


Re: Stability of current source?

Posted by Wouter Cloetens <wc...@raleigh.ibm.com>.
Yes, Graham, it is actually something like that. The write() of the CR/LFs
at the end of the request could very well fail because the uplink TCP
connection already had its half-close done (though I thought that it was
always the side that wrote output that had to initiate that?). I'll run a
packet trace to see if that's true. That behaviour I could understand.
Getting the failure not only on write(), but also on subsequent read()s,
baffles me.

If I write the whole request as one big byte array, everything works
peachy. I thought then that inserting a BufferedOutputStream might do the
trick, but that chokes too, which is really a convincing argument in
support of the theory that the JVMs are at fault. Write Once, Debug
Everywhere...

bfn, Wouter

graham glass wrote:

> hi wouter,
>
> even tho i'm not on the apache development team, i'll describe
> an experience that i had building my own SOAP implementation
> that may or may not be relevant.
>
> in my case, the problem lay with socket behavior and keep alive
> connections. i was writing programs that talked to each other
> and sent a set of messages in a row. the client was a "keep alive"
> client but the server was not.
>
> the odd thing i found was that when the server closed its socket
> connection after receiving and sending back a single response,
> the client was able to write *another* message to the same
> socket connection even though the server had closed its end,
> and the client only received an exception after it had made
> several calls to write().
>
> the behavior of write() seems to be that it'll accept at least
> a few bytes on a broken connection and its only when it attempts
> to flush some of the bytes that it finally realises that there's
> a connection problem.
>
> i wrote a small program to verify this behavior, and was able to
> reproduce the problem with a tiny amount of code, so i'm 100% that
> this behavior exists.
>
> might this explain what you're seeing?
>
> cheers,
> graham
>
> -----Original Message-----
> From: zombie@gnkhelp308.greenock.uk.ibm.com
> [mailto:zombie@gnkhelp308.greenock.uk.ibm.com]On Behalf Of Wouter
> Cloetens
> Sent: Friday, January 05, 2001 3:32 PM
> To: soap-dev@xml.apache.org
> Subject: Re: Stability of current source?
>
> Ok, now I so annoyed that I setup an environment to recreate the
> problem. Running Linux with both the Sun 1.3 standard edition JVM and
> the IBM Java 1.1.8 JVM, and Tomcat 3.2.1, I can recreate the problem. It
> happens very often with the Sun JVM, hardly ever with the IBM JVM. This
> never happened with the same IBM JVM on AIX, 1.1.7 on OS/2 or 1.2.2 on
> Windows NT.
> Sometimes the server response is blank, sometimes it's complete but the
> client still throws its exception. It's as if the JVM stops allowing a
> read from the OutputStream on the socket when the socket's been closed
> (even if the data hasn't been read completely yet). I'm spooked by all
> this, but I'm on it like a bloodhound.
>
> bfn, Wouter


RE: Stability of current source?

Posted by graham glass <gr...@mindspring.com>.
hi wouter,

even tho i'm not on the apache development team, i'll describe
an experience that i had building my own SOAP implementation
that may or may not be relevant.

in my case, the problem lay with socket behavior and keep alive
connections. i was writing programs that talked to each other
and sent a set of messages in a row. the client was a "keep alive"
client but the server was not.

the odd thing i found was that when the server closed its socket
connection after receiving and sending back a single response,
the client was able to write *another* message to the same 
socket connection even though the server had closed its end,
and the client only received an exception after it had made
several calls to write().

the behavior of write() seems to be that it'll accept at least
a few bytes on a broken connection and its only when it attempts
to flush some of the bytes that it finally realises that there's
a connection problem.

i wrote a small program to verify this behavior, and was able to
reproduce the problem with a tiny amount of code, so i'm 100% that
this behavior exists.

might this explain what you're seeing?

cheers,
graham

-----Original Message-----
From: zombie@gnkhelp308.greenock.uk.ibm.com
[mailto:zombie@gnkhelp308.greenock.uk.ibm.com]On Behalf Of Wouter
Cloetens
Sent: Friday, January 05, 2001 3:32 PM
To: soap-dev@xml.apache.org
Subject: Re: Stability of current source?


Ok, now I so annoyed that I setup an environment to recreate the
problem. Running Linux with both the Sun 1.3 standard edition JVM and
the IBM Java 1.1.8 JVM, and Tomcat 3.2.1, I can recreate the problem. It
happens very often with the Sun JVM, hardly ever with the IBM JVM. This
never happened with the same IBM JVM on AIX, 1.1.7 on OS/2 or 1.2.2 on
Windows NT.
Sometimes the server response is blank, sometimes it's complete but the
client still throws its exception. It's as if the JVM stops allowing a
read from the OutputStream on the socket when the socket's been closed
(even if the data hasn't been read completely yet). I'm spooked by all
this, but I'm on it like a bloodhound.

bfn, Wouter


Re: Stability of current source?

Posted by Wouter Cloetens <wc...@raleigh.ibm.com>.
Ok, now I so annoyed that I setup an environment to recreate the
problem. Running Linux with both the Sun 1.3 standard edition JVM and
the IBM Java 1.1.8 JVM, and Tomcat 3.2.1, I can recreate the problem. It
happens very often with the Sun JVM, hardly ever with the IBM JVM. This
never happened with the same IBM JVM on AIX, 1.1.7 on OS/2 or 1.2.2 on
Windows NT.
Sometimes the server response is blank, sometimes it's complete but the
client still throws its exception. It's as if the JVM stops allowing a
read from the OutputStream on the socket when the socket's been closed
(even if the data hasn't been read completely yet). I'm spooked by all
this, but I'm on it like a bloodhound.

bfn, Wouter