https://bz.apache.org/bugzilla/show_bug.cgi?id=59010

            Bug ID: 59010
           Summary: Disabling socketBuffer with "-1" doesn't cause
                    exception on linux
           Product: Tomcat 7
           Version: 7.0.54
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: rashmikatag...@in.ibm.com

I have implemented a service using Http11Protocol and I have disabled the
socketBuffer for the object by setting its value to "-1". When the client
disconnects before the server responds, then on windows I see the exception:

SEVERE: Error processing request
java.net.SocketException: Unrecognized Windows Sockets error: 0: socket write
er
ror
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:125)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:171)
        at
org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffe
r.doWrite(InternalOutputBuffer.java:243)
        at
org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(Identit
yOutputFilter.java:84)
        at
org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputB
uffer.java:192)
        at org.apache.coyote.Response.doWrite(Response.java:499)
        at dummyAdapter.service(dummyAdapter.java:49)

But on linux, I don't see any exception raised.

My listener looks like this:
public class TomcatCipherTst {
   public static void main(String[] args) throws Exception {
    Http11Protocol h1p = new BrokerProtocolHandler();  
    h1p.setSocketBuffer(-1);
        h1p.setMaxKeepAliveRequests(-1);
        Adapter ac = new dummyAdapter();
        h1p.setAdapter(ac);
        h1p.setPort(7677);
    h1p.init();
    h1p.start();

    boolean status = ((BrokerProtocolHandler)h1p).getEndpoint().isRunning();

        System.out.println("status = " + status);

        Thread.sleep(1000000);  
      }
    }

My adapter service implementation looks like this:
public class dummyAdapter implements Adapter {
  public boolean asyncDispatch(Request arg0, Response arg1, SocketStatus arg2)
            throws Exception {
            return false;
    }

    public boolean event(Request arg0, Response arg1, SocketStatus arg2)
            throws Exception {
        return false;
    }

    public String getDomain() {
        return null;
    }

    public void log(Request arg0, Response arg1, long arg2) {

    }

    public void service(Request req, Response res) throws Exception {

        System.out.println("We got em");
        Thread.sleep(3000);

    String resp = new String("We got request for |" +
req.requestURI().toString() + "|");
        ByteChunk bc = new ByteChunk();
        byte[] respBA = resp.getBytes("utf-8");
        bc.setBytes(respBA, 0, respBA.length);
        res.setContentLength(respBA.length);
        res.doWrite(bc);
        res.finish();
    }

    public void checkRecycled(Request arg0, Response arg1) {

    }

    public void errorDispatch(Request arg0, Response arg1) {

    }
}

BrokerProtocolHandler is:
public class BrokerProtocolHandler extends
org.apache.coyote.http11.Http11Protocol
{
    public BrokerProtocolHandler() {
        super();
    }

    public AbstractEndpoint getEndpoint() {
        return endpoint;
    }
}



Can you please take a look at this and help us understand why there is no
exception on linux?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to