geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@geronimo.apache.org
Subject [jira] Commented: (GERONIMO-373) Percolate errors from SocketProtocol up the stack
Date Wed, 13 Oct 2004 12:56:51 GMT
The following comment has been added to this issue:

     Author: David Farb
    Created: Wed, 13 Oct 2004 5:56 AM
       Body:
Alan said: 'I'm not entirely comfortable with protocols calling each other directly and much
prefer an IOC type mechanism but, I'm open to discussion.'

I'm not sure exactly what you mean by that, here is specifically what I would propose:

1. Modify the existing Protocol interface to include a 'public void fail();' method signature.

2. Modify the existing SocketProtocol class to support the fail() method. For example, add
up.fail() to the IOException handler of serviceRead():

    } catch (IOException e) {
        log.trace("Communications error, closing connection: ", e);
        up.fail();
        close();

and apply similar modifications in other locations. close() itself does NOT call fail(), since
closing is not a failure.

3. Modify the existing classes that implement the Protocol interface with a suitable implementation
of the fail() method. The fail() method on SocketProtocol, for example, does nothing since
SocketProtocol is at the bottom of the stack. SocketProtocol has no 'down' protocol, so there
is no protocol that could call the fail method of SocketProtocol.  

In reality this is similar to the method call: 'up.sendUp(packet);' which sends the normal,
expected result from SocketProtocol to the next protocol up the stack. 'up.fail();' simply
sends an abnormal result from SocketProtocol to the next protocol up the stack.

---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/GERONIMO-373?page=comments#action_53988

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/GERONIMO-373

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: GERONIMO-373
    Summary: Percolate errors from SocketProtocol up the stack
       Type: Improvement

     Status: Unassigned
   Priority: Major

    Project: Apache Geronimo
 Components: 
             general

   Assignee: 
   Reporter: David Farb

    Created: Tue, 12 Oct 2004 9:42 AM
    Updated: Wed, 13 Oct 2004 5:56 AM
Environment: All environments

Description:
o.a.g.network.protocol.SocketProtocol does not percolate a client error or exception up the
protocol stack when the client disconnects.

When serviceRead in SocketProtocol gets an IOException or some other error, the socketChannel
is closed, but the up protocol is not informed.

Calling the teardown method of the up protocol is probably not an appropriate way to handle
these exceptions. The teardown method should be called by the creator of the protocol stack.
Instead, the exception/error should percolate up the protocol stack to the creator (via some
sort of callback mechanism) which should then remove the stack and associated information
from the server environment. 

Either a new method reserved for this could be defined in the Protocol interface (up.handleException(Throwable
t)) or sending a null, empty or specially marked packet via up.sendUp(UpPacket upPacket) could
be implemented.

Since in most cases the server is waiting for a client response, if the client goes away,
server components need to be informed of this fact so the server side objects can be cleaned
up. There is usually no way to recover these objects, hence they are a memory leak.

I would be happy to submit a fix for this, but I would appreciate feedback on the most appropriate
way to do it.

Thanks
David Farb







---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message