You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Emmanuel Lecharny <el...@gmail.com> on 2010/02/04 17:08:54 UTC
About message response handling in the API
Hi guys,
I think we have a huge problem in the current ldap-api implementation.
Currently, when we send a request, we cretae an associated Future in
which we store a response queue we have created to store the response
when it will arrive. So far, so good.
The problem is that we need to associate an incoming response to the
Future it is targeting. To do so we have a FutureMap<int, Future>, and
as every response has the same MessageId than the associated request, we
can easily find which request a response is associated to.
So when we get a response, we extract its messageId, do a lookup in the
futureMap and get back the Future, then we update the queue with the
response. The client which is doing a future.get() will then get its
response.
Now, we could perfectly unbind, and rebind immediately. What happens ?
The session is then closed, and all responses we are waiting for will be
discarded. First big bug here : we don't cleanup the futureMap.
Another case : instead of unbinding, we send an abandon request. It
seems that we clean up the futureMap.
Last, not least, we can re-bind. In this case, the connection is not
reset, but we start with a new MessageId, starting at 1. And we have
another bug here : we don't cleanup the futureMap.
So we have to check all those cases and fix them.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com
Re: About message response handling in the API
Posted by Kiran Ayyagari <ay...@gmail.com>.
> I think we have a huge problem in the current ldap-api implementation.
> Currently, when we send a request, we cretae an associated Future in which
> we store a response queue we have created to store the response when it will
> arrive. So far, so good.
>
> The problem is that we need to associate an incoming response to the Future
> it is targeting. To do so we have a FutureMap<int, Future>, and as every
> response has the same MessageId than the associated request, we can easily
> find which request a response is associated to.
>
> So when we get a response, we extract its messageId, do a lookup in the
> futureMap and get back the Future, then we update the queue with the
> response. The client which is doing a future.get() will then get its
> response.
>
> Now, we could perfectly unbind, and rebind immediately. What happens ? The
> session is then closed, and all responses we are waiting for will be
> discarded. First big bug here : we don't cleanup the futureMap.
>
> Another case : instead of unbinding, we send an abandon request. It seems
> that we clean up the futureMap.
>
> Last, not least, we can re-bind. In this case, the connection is not reset,
> but we start with a new MessageId, starting at 1. And we have another bug
> here : we don't cleanup the futureMap.
>
> So we have to check all those cases and fix them.
+1
right now I don't have access to the code, will take a look at these
issues, and am sure
as you said during unbind only the futureMap is cleaned atm
thanks Emmanuel
Kiran Ayyagari